240 lines
14 KiB
XML
240 lines
14 KiB
XML
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:conv="clr-namespace:WPFluent.Converters"
|
|
xmlns:controls="clr-namespace:WPFluent.Controls">
|
|
|
|
<conv:TreeModelLevelToIndentConverter x:Key="TreeModelLevelToIndentConverter" />
|
|
<conv:TreeModelCanExpandConverter x:Key="TreeModelCanExpandConverter" />
|
|
<conv:TreeModelCanExpandConverter x:Key="TreeModelCanExpandInverter" IsInverted="True" />
|
|
<FontFamily x:Key="SymbolThemeFontFamily">pack://application:,,,/WPFluent;component/Resources/Fonts/Segoe Fluent Icons.ttf#Segoe Fluent Icons</FontFamily>
|
|
|
|
<ControlTemplate x:Key="TreeModelGridViewScrollViewerTemplate" TargetType="{x:Type ScrollViewer}">
|
|
<Grid Background="Transparent">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<DockPanel Margin="{TemplateBinding Control.Padding}">
|
|
<ScrollViewer
|
|
DockPanel.Dock="Top"
|
|
Focusable="False"
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
VerticalScrollBarVisibility="Hidden">
|
|
<!-- margin-left matched to listviewitem.padding -->
|
|
<controls:GridViewHeaderRowPresenter
|
|
Margin="4"
|
|
AllowsColumnReorder="{Binding Path=View.AllowsColumnReorder, RelativeSource={RelativeSource AncestorType=ListView}}"
|
|
ColumnHeaderContainerStyle="{Binding Path=View.ColumnHeaderContainerStyle, RelativeSource={RelativeSource AncestorType=ListView}}"
|
|
ColumnHeaderContextMenu="{Binding Path=View.ColumnHeaderContextMenu, RelativeSource={RelativeSource AncestorType=ListView}}"
|
|
ColumnHeaderTemplate="{Binding Path=View.ColumnHeaderTemplate, RelativeSource={RelativeSource AncestorType=ListView}}"
|
|
ColumnHeaderToolTip="{Binding Path=View.ColumnHeaderToolTip, RelativeSource={RelativeSource AncestorType=ListView}}"
|
|
Columns="{Binding Path=View.Columns, RelativeSource={RelativeSource AncestorType=ListView}}"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|
</ScrollViewer>
|
|
<ScrollContentPresenter
|
|
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
|
CanHorizontallyScroll="False"
|
|
CanVerticallyScroll="False"
|
|
Content="{TemplateBinding ContentControl.Content}"
|
|
ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
|
|
KeyboardNavigation.DirectionalNavigation="Local"
|
|
Name="PART_ScrollContentPresenter"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|
</DockPanel>
|
|
<ScrollBar
|
|
Grid.Column="1"
|
|
Value="{Binding Path=VerticalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
|
Cursor="Arrow"
|
|
Maximum="{TemplateBinding ScrollViewer.ScrollableHeight}"
|
|
Minimum="0"
|
|
Name="PART_VerticalScrollBar"
|
|
Orientation="Vertical"
|
|
ViewportSize="20"
|
|
Visibility="{TemplateBinding ScrollViewer.ComputedVerticalScrollBarVisibility}" />
|
|
<ScrollBar
|
|
Grid.Row="1"
|
|
Value="{Binding Path=HorizontalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
|
Cursor="Arrow"
|
|
Maximum="{TemplateBinding ScrollViewer.ScrollableWidth}"
|
|
Minimum="0"
|
|
Name="PART_HorizontalScrollBar"
|
|
Orientation="Horizontal"
|
|
ViewportSize="20"
|
|
Visibility="{TemplateBinding ScrollViewer.ComputedHorizontalScrollBarVisibility}" />
|
|
<DockPanel
|
|
Grid.Row="1"
|
|
Grid.Column="1"
|
|
LastChildFill="False">
|
|
<Rectangle
|
|
Width="1"
|
|
DockPanel.Dock="Left"
|
|
Fill="#FFFFFFFF"
|
|
Visibility="{TemplateBinding ScrollViewer.ComputedVerticalScrollBarVisibility}" />
|
|
<Rectangle
|
|
Height="1"
|
|
DockPanel.Dock="Top"
|
|
Fill="#FFFFFFFF"
|
|
Visibility="{TemplateBinding ScrollViewer.ComputedHorizontalScrollBarVisibility}" />
|
|
</DockPanel>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
|
|
<Style x:Key="TreeModelListViewStyle" TargetType="{x:Type controls:TreeModelListView}">
|
|
<Setter Property="CornerRadius" Value="3" />
|
|
<Setter Property="Margin" Value="0" />
|
|
<Setter Property="Padding" Value="0" />
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type controls:TreeModelListView}">
|
|
<Border
|
|
Background="Transparent"
|
|
BorderBrush="{TemplateBinding Border.BorderBrush}"
|
|
BorderThickness="{TemplateBinding Border.BorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}"
|
|
Name="Bd">
|
|
<controls:PassiveScrollViewer
|
|
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
|
Focusable="False"
|
|
Padding="{TemplateBinding Control.Padding}"
|
|
Template="{DynamicResource TreeModelGridViewScrollViewerTemplate}">
|
|
<ItemsPresenter />
|
|
</controls:PassiveScrollViewer>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
|
|
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Standard" />
|
|
</Style>
|
|
|
|
<Style BasedOn="{StaticResource TreeModelListViewStyle}" TargetType="{x:Type controls:TreeModelListView}" />
|
|
|
|
<Style x:Key="TreeModelExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
|
|
<Setter Property="Focusable" Value="False" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ToggleButton">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<controls:FontIcon
|
|
x:Name="ExpandPath"
|
|
Grid.Column="0"
|
|
Width="19"
|
|
VerticalAlignment="Center"
|
|
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
|
Glyph="{x:Static controls:FontSymbols.ChevronRight}" />
|
|
<ContentPresenter
|
|
x:Name="ContentPresenter"
|
|
Grid.Column="1"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Content="{TemplateBinding Content}"
|
|
TextElement.FontSize="{TemplateBinding FontSize}"
|
|
TextElement.Foreground="{TemplateBinding Foreground}" />
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
|
<Setter TargetName="ExpandPath" Property="Glyph" Value="{x:Static controls:FontSymbols.ChevronDown}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="DefaultTreeModelRowExpanderStyle" TargetType="{x:Type controls:TreeModelRowExpander}">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="Focusable" Value="False" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type controls:TreeModelRowExpander}">
|
|
<Grid Margin="{Binding Node.Level, Converter={StaticResource TreeModelLevelToIndentConverter}, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeModelListViewItem}}}">
|
|
<ToggleButton
|
|
ClickMode="Press"
|
|
Content="{TemplateBinding Content}"
|
|
IsChecked="{Binding Node.IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeModelListViewItem}}}"
|
|
Style="{StaticResource TreeModelExpandCollapseToggleStyle}"
|
|
Visibility="{Binding Node.IsExpandable, Converter={StaticResource TreeModelCanExpandConverter}, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeModelListViewItem}}}" />
|
|
<ContentPresenter
|
|
Margin="19,0,0,0"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Content="{TemplateBinding Content}"
|
|
TextElement.FontSize="{TemplateBinding FontSize}"
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
Visibility="{Binding Node.IsExpandable, Converter={StaticResource TreeModelCanExpandInverter}, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeModelListViewItem}}}" />
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style BasedOn="{StaticResource DefaultTreeModelRowExpanderStyle}" TargetType="{x:Type controls:TreeModelRowExpander}" />
|
|
|
|
<Style x:Key="DefaultTreeModelListViewItemStyle" TargetType="{x:Type controls:TreeModelListViewItem}">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForeground}" />
|
|
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
|
|
<Setter Property="Margin" Value="0,0,0,2" />
|
|
<Setter Property="Padding" Value="4" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate>
|
|
<Border
|
|
x:Name="Border"
|
|
Margin="0"
|
|
Background="Transparent"
|
|
BorderBrush="{TemplateBinding Border.BorderBrush}"
|
|
BorderThickness="{TemplateBinding Border.BorderThickness}"
|
|
CornerRadius="{TemplateBinding Border.CornerRadius}"
|
|
Padding="0">
|
|
<Grid>
|
|
<controls:GridViewRowPresenter
|
|
Margin="{TemplateBinding Padding}"
|
|
VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
|
|
Columns="{TemplateBinding GridView.ColumnCollection}"
|
|
Content="{TemplateBinding ContentControl.Content}" />
|
|
<Rectangle
|
|
x:Name="ActiveRectangle"
|
|
Width="3"
|
|
Height="18"
|
|
Margin="0"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Fill="{DynamicResource ListViewItemPillFillBrush}"
|
|
RadiusX="2"
|
|
RadiusY="2"
|
|
Visibility="Collapsed" />
|
|
</Grid>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style BasedOn="{StaticResource DefaultTreeModelListViewItemStyle}" TargetType="{x:Type controls:TreeModelListViewItem}" />
|
|
|
|
</ResourceDictionary> |