<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:controls="clr-namespace:UILib">
|
|
<controls:IndentConverter x:Key="IndentConverter"/>
|
|
<Style TargetType="{x:Type controls:TreeListView}">
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type controls:TreeListView}">
|
<Border BorderBrush="{TemplateBinding BorderBrush}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
Background="{TemplateBinding Background}">
|
<Grid>
|
<Grid.RowDefinitions>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition/>
|
<RowDefinition Height="Auto"/>
|
</Grid.RowDefinitions>
|
<GridViewHeaderRowPresenter Grid.Row="0"
|
Columns="{TemplateBinding Columns}"/>
|
<ScrollViewer Grid.Row="1" Padding="{TemplateBinding Padding}" VerticalScrollBarVisibility="Auto">
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
</ScrollViewer>
|
</Grid>
|
</Border>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<Style x:Key="TreeTotalIndex" TargetType="TextBlock">
|
<Setter Property="Margin" Value="0"/>
|
<Setter Property="Padding" Value="0"/>
|
<Setter Property="Text">
|
<Setter.Value>
|
<MultiBinding Converter="{x:Static controls:TreeListViewButtonConverter.Instance}" ConverterParameter="Index">
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}"/>
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="level" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="index" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="IsExpanded" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="IsLastNode" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="HasItems" />
|
</MultiBinding>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
|
<Setter Property="Margin" Value="0"/>
|
<Setter Property="Padding" Value="0"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="ToggleButton">
|
<Grid x:Name="cross" Cursor="Hand">
|
<Path Fill="LightYellow" Height="{Binding ActualHeight,RelativeSource={RelativeSource AncestorLevel=1,AncestorType=Control}}"
|
Margin="0" Stroke="{TemplateBinding Foreground}" StrokeThickness="1">
|
<Path.Width>
|
<MultiBinding Converter="{x:Static controls:TreeListViewButtonConverter.Instance}" ConverterParameter="Size">
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}"/>
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="level" />
|
<Binding RelativeSource="{RelativeSource Mode=Self}" Path="Height"/>
|
</MultiBinding>
|
</Path.Width>
|
|
<Path.Data>
|
<MultiBinding Converter="{x:Static controls:TreeListViewButtonConverter.Instance}" ConverterParameter="Content">
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}"/>
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="level" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="index" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="IsExpanded" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="IsLastNode" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="HasItems" />
|
<Binding RelativeSource="{RelativeSource Mode=Self}" Path="Height"/>
|
</MultiBinding>
|
</Path.Data>
|
</Path>
|
</Grid>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<Style x:Key="SimpleToggleButton" TargetType="ToggleButton">
|
<Setter Property="Margin" Value="0"/>
|
<Setter Property="Padding" Value="0"/>
|
<Setter Property="ClickMode" Value="Press"/>
|
<Setter Property="IsChecked" Value="{Binding IsExpanded, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=controls:TreeListViewItem,AncestorLevel=1}}"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="ToggleButton">
|
<Grid x:Name="cross" Cursor="Hand">
|
<Path Fill="Transparent" Height="{Binding ActualHeight,RelativeSource={RelativeSource AncestorLevel=1,AncestorType=Control}}"
|
Margin="0" Stroke="{TemplateBinding Foreground}" StrokeThickness="1">
|
<Path.Width>
|
<MultiBinding Converter="{x:Static controls:SimpleTreeListViewButtonConverter.Instance}" ConverterParameter="Size">
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}"/>
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="level" />
|
<Binding RelativeSource="{RelativeSource Mode=Self}" Path="Height"/>
|
</MultiBinding>
|
</Path.Width>
|
|
<Path.Data>
|
<MultiBinding Converter="{x:Static controls:SimpleTreeListViewButtonConverter.Instance}" ConverterParameter="Content">
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}"/>
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="level" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="index" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="IsExpanded" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="IsLastNode" />
|
<Binding RelativeSource="{RelativeSource AncestorType=controls:TreeListViewItem,AncestorLevel=1,Mode=FindAncestor}" Path="HasItems" />
|
<Binding RelativeSource="{RelativeSource Mode=Self}" Path="Height"/>
|
</MultiBinding>
|
</Path.Data>
|
</Path>
|
</Grid>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<ControlTemplate x:Key="tvi" TargetType="{x:Type controls:TreeListViewItem}">
|
<Grid>
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="*"/>
|
</Grid.ColumnDefinitions>
|
<Grid.RowDefinitions>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition/>
|
</Grid.RowDefinitions>
|
|
<Border x:Name="Bd" Grid.Column="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
Padding="{TemplateBinding Padding}">
|
|
<!--<GridViewRowPresenter x:Name="sb" Grid.Column="1" Columns="{TemplateBinding Columns}"
|
Content="{Binding }"/>-->
|
|
<ContentPresenter Margin="0" Grid.Column="0" x:Name="cp" Content="{TemplateBinding Header}"
|
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"/>
|
|
<!--<Grid>
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="*"/>
|
</Grid.ColumnDefinitions>
|
|
-->
|
<!--<GridViewRowPresenter Grid.Column="1" Columns="{TemplateBinding Columns}"
|
Content="{Binding }"/>-->
|
<!--
|
</Grid>-->
|
</Border>
|
|
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="1"/>
|
</Grid>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsExpanded" Value="False">
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ItemsHost"/>
|
</Trigger>
|
<DataTrigger Binding="{Binding IsSelected,RelativeSource={RelativeSource Mode=Self}}" Value="True">
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
<Setter Property="TextBlock.Foreground" TargetName="cp" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
|
</DataTrigger>
|
<!--<DataTrigger Binding="{Binding IsMouseOver,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=controls:TreeListViewItem,AncestorLevel=1}}" Value="True">
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
|
</DataTrigger>-->
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
|
<Style TargetType="{x:Type controls:TreeListViewItem}">
|
<Setter Property="Margin" Value="0"/>
|
<Setter Property="Padding" Value="0"/>
|
<Setter Property="Template" Value="{StaticResource tvi}"/>
|
</Style>
|
|
<Style TargetType="{x:Type controls:EditBox}">
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type controls:EditBox}">
|
<Grid Cursor="Hand" MinWidth="{TemplateBinding MinWidth}" Background="{TemplateBinding Background}">
|
<Border x:Name="PART_BoraderPart" VerticalAlignment="Center" Padding="0" Margin="0">
|
<Border.Style>
|
<Style TargetType="Border">
|
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
<Style.Triggers>
|
<MultiDataTrigger>
|
<MultiDataTrigger.Conditions>
|
<Condition Binding="{Binding Path=Value, RelativeSource={RelativeSource TemplatedParent}}" Value=""/>
|
<Condition Binding="{Binding Path=ShowEmpty, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
|
</MultiDataTrigger.Conditions>
|
<MultiDataTrigger.Setters>
|
<Setter Property="BorderBrush" Value="Black"/>
|
<Setter Property="BorderThickness" Value="0,0,0,0.6"/>
|
</MultiDataTrigger.Setters>
|
</MultiDataTrigger>
|
<MultiDataTrigger>
|
<MultiDataTrigger.Conditions>
|
<Condition Binding="{Binding Path=Value, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Null}"/>
|
<Condition Binding="{Binding Path=ShowEmpty, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
|
</MultiDataTrigger.Conditions>
|
<MultiDataTrigger.Setters>
|
<Setter Property="BorderBrush" Value="Black"/>
|
<Setter Property="BorderThickness" Value="0,0,0,0.6"/>
|
</MultiDataTrigger.Setters>
|
</MultiDataTrigger>
|
</Style.Triggers>
|
</Style>
|
</Border.Style>
|
|
<Border BorderThickness="1" BorderBrush="Transparent">
|
<TextBlock x:Name="PART_TextBlockPart" FontSize="{TemplateBinding FontSize}"
|
TextWrapping="NoWrap" Padding="0" VerticalAlignment="Center"
|
Text="{Binding Path=Value, RelativeSource={RelativeSource TemplatedParent}}"/>
|
</Border>
|
</Border>
|
<TextBox x:Name="PART_TextBoxPart" BorderThickness="1" Padding="0" Background="#FFF"
|
FontSize="{TemplateBinding FontSize}" Visibility="Collapsed"
|
Text="{Binding Path=Value, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource TemplatedParent}}"/>
|
</Grid>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
</ResourceDictionary>
|