Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TreeView.xaml « Xwt.WPFBackend « Xwt.WPF - github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 72f823db88e9a76f0fa75bfe9fb7cc2943eadbb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:l="clr-namespace:Xwt.WPFBackend;assembly=Xwt.WPF">

	<Style TargetType="{x:Type l:ExTreeViewItem}">
		<Setter Property="IsExpanded" Value="{Binding IsExpanded,Mode=TwoWay}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="l:ExTreeViewItem">
					<StackPanel>
						<Border Name="HBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
							<GridViewRowPresenter x:Name="PART_Header" Content="{TemplateBinding Header}" Columns="{Binding Path=View.Columns, RelativeSource={RelativeSource AncestorType={x:Type l:ExTreeView}}}" />
						</Border>
						<ItemsPresenter x:Name="ItemsHost" />
					</StackPanel>

					<ControlTemplate.Triggers>
						<Trigger Property="IsExpanded" Value="False">
							<Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed" />
						</Trigger>

						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="HasHeader" Value="False" />
								<Condition Property="Width" Value="Auto" />
							</MultiTrigger.Conditions>
							<Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
						</MultiTrigger>

						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="HasHeader" Value="False" />
								<Condition Property="Height" Value="Auto" />
							</MultiTrigger.Conditions>
							<Setter Property="MinHeight" Value="19" />
						</MultiTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>

		<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
		<Setter Property="BorderThickness" Value="1" />
		<Style.Triggers>
			<Trigger Property="IsSelected" Value="True">
				<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
				<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
			</Trigger>

			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsSelected" Value="True" />
					<Condition Property="IsSelectionActive" Value="False" />
				</MultiTrigger.Conditions>
				<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
				<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
				<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
			</MultiTrigger>

			<Trigger Property="IsEnabled" Value="False">
				<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
			</Trigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsSelected" Value="False" />
					<Condition Property="IsFocused" Value="False" />
				</MultiTrigger.Conditions>
				<Setter Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource Self}, Path=Background}" />
			</MultiTrigger>
		</Style.Triggers>
	</Style>
	
	<Style TargetType="{x:Type l:ExTreeView}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate>
					<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
						<ScrollViewer Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}" Padding="{TemplateBinding Padding}">
							<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
						</ScrollViewer>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>