286 lines
17 KiB
Plaintext
286 lines
17 KiB
Plaintext
|
|
<ResourceDictionary
|
||
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
|
xmlns:controls="clr-namespace:WPFDark.Controls"
|
||
|
|
xmlns:internals="clr-namespace:WPFDark.Internals"
|
||
|
|
xmlns:wpf="clr-namespace:WPFDark"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||
|
|
<Style TargetType="ToggleButton" x:Key="ExpandCollapseToggleStyle">
|
||
|
|
<Setter Property="Focusable" Value="False" />
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="ToggleButton">
|
||
|
|
<Canvas
|
||
|
|
Background="Transparent"
|
||
|
|
Height="15"
|
||
|
|
Width="15">
|
||
|
|
<Path Data="M 5.367188 10.363281 L 8.230469 7.5 L 5.367188 4.632812 L 6.25 3.75 L 10 7.5 L 6.25 11.25 Z M 5.367188 10.363281" x:Name="ExpandPath">
|
||
|
|
<Path.Style>
|
||
|
|
<Style TargetType="{x:Type Path}">
|
||
|
|
<Setter Property="Fill" Value="{DynamicResource ForegroundBrushKey}" />
|
||
|
|
<Style.Triggers>
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter Property="Fill" Value="{DynamicResource InactiveForegroundBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
</Path.Style>
|
||
|
|
</Path>
|
||
|
|
</Canvas>
|
||
|
|
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="IsChecked" Value="True">
|
||
|
|
<Setter Property="Data" TargetName="ExpandPath" Value="M 4.632812 5.363281 L 7.5 8.230469 L 10.367188 5.363281 L 11.25 6.25 L 7.5 10 L 3.75 6.25 Z M 4.632812 5.363281" />
|
||
|
|
</Trigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
|
||
|
|
<Setter Property="Visibility" Value="Visible" />
|
||
|
|
|
||
|
|
<Style.Triggers>
|
||
|
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=IsVisibleItemExpanderButton}" Value="False">
|
||
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
||
|
|
</DataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style x:Key="TreeViewItemFocusVisualStyle">
|
||
|
|
<Setter Property="Control.Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate>
|
||
|
|
<Border>
|
||
|
|
<Rectangle
|
||
|
|
Margin="0"
|
||
|
|
Opacity="0.0"
|
||
|
|
Stroke="White"
|
||
|
|
StrokeDashArray="1 2"
|
||
|
|
StrokeThickness="5.0" />
|
||
|
|
</Border>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type TreeViewItem}" x:Key="TreeViewItemContainerStyle">
|
||
|
|
<Setter Property="Background" Value="Transparent" />
|
||
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||
|
|
<Setter Property="Padding" Value="1" />
|
||
|
|
<Setter Property="BorderThickness" Value="0" />
|
||
|
|
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||
|
|
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
|
||
|
|
<Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisualStyle}" />
|
||
|
|
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type TreeViewItem}">
|
||
|
|
<StackPanel>
|
||
|
|
<Border
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
|
Name="Bd"
|
||
|
|
Padding="{TemplateBinding Padding}">
|
||
|
|
<Grid>
|
||
|
|
<Grid.Style>
|
||
|
|
<Style TargetType="{x:Type Grid}">
|
||
|
|
<Setter Property="Margin">
|
||
|
|
<Setter.Value>
|
||
|
|
<MultiBinding Converter="{x:Static wpf:Constants.LengthConverter}">
|
||
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
<Binding Path="IndentSize" RelativeSource="{RelativeSource AncestorType={x:Type controls:BiaTreeView}}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
</Grid.Style>
|
||
|
|
|
||
|
|
<Grid.ColumnDefinitions>
|
||
|
|
<ColumnDefinition Width="19" />
|
||
|
|
<ColumnDefinition />
|
||
|
|
</Grid.ColumnDefinitions>
|
||
|
|
|
||
|
|
<!-- x:NameはWPFDark.Internals.Constants.TreeViewItemExpanderName -->
|
||
|
|
<ToggleButton
|
||
|
|
ClickMode="Press"
|
||
|
|
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
|
||
|
|
Style="{StaticResource ExpandCollapseToggleStyle}"
|
||
|
|
x:Name="Expander" />
|
||
|
|
|
||
|
|
<ContentPresenter
|
||
|
|
ContentSource="Header"
|
||
|
|
Grid.Column="1"
|
||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
x:Name="PART_Header" />
|
||
|
|
</Grid>
|
||
|
|
</Border>
|
||
|
|
<ItemsPresenter x:Name="ItemsHost" />
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="IsExpanded" Value="False">
|
||
|
|
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed" />
|
||
|
|
</Trigger>
|
||
|
|
|
||
|
|
<Trigger Property="HasItems" Value="False">
|
||
|
|
<Setter Property="Visibility" TargetName="Expander" Value="Hidden" />
|
||
|
|
</Trigger>
|
||
|
|
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||
|
|
</Trigger>
|
||
|
|
|
||
|
|
<MultiDataTrigger>
|
||
|
|
<MultiDataTrigger.Conditions>
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(internals:TreeViewHelper.IsMouseDirectlyOverItem)}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=IsSelectionEnabled}" Value="True" />
|
||
|
|
</MultiDataTrigger.Conditions>
|
||
|
|
|
||
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ActiveBackgroundBrushKey}" />
|
||
|
|
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource ActiveBackgroundBrushKey}" />
|
||
|
|
</MultiDataTrigger>
|
||
|
|
|
||
|
|
<MultiDataTrigger>
|
||
|
|
<MultiDataTrigger.Conditions>
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(controls:BiaTreeView.IsSelected)}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=IsSelectionEnabled}" Value="True" />
|
||
|
|
</MultiDataTrigger.Conditions>
|
||
|
|
|
||
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.SelectedInactive.Background}" />
|
||
|
|
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.SelectedInactive.Border}" />
|
||
|
|
</MultiDataTrigger>
|
||
|
|
|
||
|
|
<MultiDataTrigger>
|
||
|
|
<MultiDataTrigger.Conditions>
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(internals:TreeViewHelper.IsMouseDirectlyOverItem)}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(controls:BiaTreeView.IsSelected)}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=IsMouseOver}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=IsSelectionEnabled}" Value="True" />
|
||
|
|
</MultiDataTrigger.Conditions>
|
||
|
|
|
||
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.SelectedActive.Background.IsMouseOver}" />
|
||
|
|
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.SelectedActive.Border.IsMouseOver}" />
|
||
|
|
</MultiDataTrigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style
|
||
|
|
BasedOn="{StaticResource TreeViewItemContainerStyle}"
|
||
|
|
TargetType="{x:Type TreeViewItem}"
|
||
|
|
x:Key="ListBoxLikeTreeViewItemContainerStyle">
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type TreeViewItem}">
|
||
|
|
<Border
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
|
Name="Bd"
|
||
|
|
Padding="{TemplateBinding Padding}">
|
||
|
|
<ContentPresenter
|
||
|
|
ContentSource="Header"
|
||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
x:Name="PART_Header" />
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||
|
|
</Trigger>
|
||
|
|
|
||
|
|
<MultiDataTrigger>
|
||
|
|
<MultiDataTrigger.Conditions>
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(internals:TreeViewHelper.IsMouseDirectlyOverItem)}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=IsSelectionEnabled}" Value="True" />
|
||
|
|
</MultiDataTrigger.Conditions>
|
||
|
|
|
||
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ActiveBackgroundBrushKey}" />
|
||
|
|
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource ActiveBackgroundBrushKey}" />
|
||
|
|
</MultiDataTrigger>
|
||
|
|
|
||
|
|
<MultiDataTrigger>
|
||
|
|
<MultiDataTrigger.Conditions>
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(controls:BiaTreeView.IsSelected)}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=IsSelectionEnabled}" Value="True" />
|
||
|
|
</MultiDataTrigger.Conditions>
|
||
|
|
|
||
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.SelectedInactive.Background}" />
|
||
|
|
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.SelectedInactive.Border}" />
|
||
|
|
</MultiDataTrigger>
|
||
|
|
|
||
|
|
<MultiDataTrigger>
|
||
|
|
<MultiDataTrigger.Conditions>
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(internals:TreeViewHelper.IsMouseDirectlyOverItem)}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(controls:BiaTreeView.IsSelected)}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=IsMouseOver}" Value="True" />
|
||
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=IsSelectionEnabled}" Value="True" />
|
||
|
|
</MultiDataTrigger.Conditions>
|
||
|
|
|
||
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.SelectedActive.Background.IsMouseOver}" />
|
||
|
|
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.SelectedActive.Border.IsMouseOver}" />
|
||
|
|
</MultiDataTrigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type controls:BiaTreeView}" x:Key="DefaultTreeViewStyle">
|
||
|
|
<Setter Property="Background" Value="{DynamicResource TextBoxBackgroundBrushKey}" />
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrushKey}" />
|
||
|
|
<Setter Property="BorderThickness" Value="1" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource TextBoxForegroundBrushKey}" />
|
||
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
||
|
|
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
||
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||
|
|
|
||
|
|
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
|
||
|
|
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
|
||
|
|
<Setter Property="VirtualizingStackPanel.CacheLength" Value="20,20" />
|
||
|
|
<Setter Property="VirtualizingStackPanel.CacheLengthUnit" Value="Item" />
|
||
|
|
|
||
|
|
<Setter Property="ItemContainerStyle" Value="{StaticResource TreeViewItemContainerStyle}" />
|
||
|
|
|
||
|
|
<Setter Property="ItemsPanel">
|
||
|
|
<Setter.Value>
|
||
|
|
<ItemsPanelTemplate>
|
||
|
|
<VirtualizingStackPanel CanVerticallyScroll="True" />
|
||
|
|
</ItemsPanelTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type controls:BiaTreeView}">
|
||
|
|
<controls:BiaClippingBorder
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
|
CornerRadius="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaTreeView}}, Mode=OneWay, Path=CornerRadius}"
|
||
|
|
x:Name="Bd">
|
||
|
|
<ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
|
||
|
|
<ItemsPresenter />
|
||
|
|
</ScrollViewer>
|
||
|
|
</controls:BiaClippingBorder>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
|
||
|
|
<Style.Triggers>
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter Property="Background" Value="{DynamicResource InactiveBackgroundBrushKey}" />
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource InactiveBorderBrushKey}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource InactiveForegroundBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style BasedOn="{StaticResource DefaultTreeViewStyle}" TargetType="{x:Type controls:BiaTreeView}" />
|
||
|
|
</ResourceDictionary>
|