2020-07-03 00:24:31 -07:00
|
|
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
2021-04-29 05:05:55 -07:00
|
|
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
|
2020-07-03 00:24:31 -07:00
|
|
|
|
|
|
|
<Style x:Key="Style.TreeView.ToggleButton" TargetType="{x:Type ToggleButton}">
|
|
|
|
<Setter Property="Focusable" Value="False"/>
|
|
|
|
<Setter Property="Width" Value="16" />
|
|
|
|
<Setter Property="Template">
|
|
|
|
<Setter.Value>
|
|
|
|
<ControlTemplate TargetType="ToggleButton">
|
|
|
|
<Grid Width="16" Height="16" Margin="1" Background="Transparent">
|
2021-04-02 00:45:31 -07:00
|
|
|
<Path x:Name="ExpandPath" HorizontalAlignment="Left" Width="8" Height="8" VerticalAlignment="Center" Margin="4,0,0,0" Fill="{DynamicResource Brush.FG1}" Data="M 4 0 L 8 4 L 4 8 Z"/>
|
2020-07-03 00:24:31 -07:00
|
|
|
</Grid>
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
<Trigger Property="IsChecked" Value="True">
|
|
|
|
<Setter Property="Data" TargetName="ExpandPath" Value="M 0 4 L 8 4 L 4 8 Z"/>
|
|
|
|
</Trigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
|
2021-04-29 05:05:55 -07:00
|
|
|
<Style x:Key="Style.TreeItem" TargetType="{x:Type controls:TreeItem}">
|
2020-07-03 00:24:31 -07:00
|
|
|
<Setter Property="KeyboardNavigation.AcceptsReturn" Value="True" />
|
|
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
|
|
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, Mode=OneWay, FallbackValue=Stretch, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, Mode=OneWay, FallbackValue=Center, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
2021-07-29 22:25:01 -07:00
|
|
|
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
|
2020-07-03 00:24:31 -07:00
|
|
|
<Setter Property="Template">
|
|
|
|
<Setter.Value>
|
2021-04-29 05:05:55 -07:00
|
|
|
<ControlTemplate TargetType="{x:Type controls:TreeItem}">
|
2020-07-03 00:24:31 -07:00
|
|
|
<StackPanel>
|
|
|
|
<Border
|
|
|
|
x:Name="BG"
|
|
|
|
Background="Transparent"
|
|
|
|
BorderThickness="0"
|
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
2021-04-29 05:05:55 -07:00
|
|
|
<Grid
|
2020-07-03 00:24:31 -07:00
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
Background="Transparent">
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
<ColumnDefinition/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<ToggleButton
|
|
|
|
Grid.Column="0"
|
|
|
|
x:Name="Expander"
|
|
|
|
Style="{StaticResource Style.TreeView.ToggleButton}"
|
|
|
|
IsChecked="{Binding Path=IsExpanded, RelativeSource={x:Static RelativeSource.TemplatedParent}, Mode=TwoWay}"
|
|
|
|
ClickMode="Press"/>
|
|
|
|
<ContentPresenter
|
|
|
|
x:Name="PART_Header"
|
|
|
|
Grid.Column="1"
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2021-05-17 01:47:56 -07:00
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
2020-07-03 00:24:31 -07:00
|
|
|
ContentSource="Header"
|
2021-05-18 19:12:25 -07:00
|
|
|
TextElement.FontFamily="Consolas,Microsoft YaHei UI"/>
|
2020-07-03 00:24:31 -07:00
|
|
|
</Grid>
|
|
|
|
</Border>
|
|
|
|
<ItemsPresenter x:Name="ItemsHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
|
|
|
</StackPanel>
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
<Trigger Property="IsExpanded" Value="False">
|
|
|
|
<Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed"/>
|
|
|
|
</Trigger>
|
|
|
|
<Trigger Property="HasItems" Value="False">
|
|
|
|
<Setter TargetName="Expander" Property="Visibility" Value="Hidden"/>
|
|
|
|
</Trigger>
|
2021-04-29 05:05:55 -07:00
|
|
|
<Trigger Property="IsChecked" Value="True">
|
2020-07-03 00:24:31 -07:00
|
|
|
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.Accent1}"/>
|
|
|
|
</Trigger>
|
|
|
|
<MultiTrigger>
|
|
|
|
<MultiTrigger.Conditions>
|
|
|
|
<Condition SourceName="BG" Property="IsMouseOver" Value="True"/>
|
2021-04-29 05:05:55 -07:00
|
|
|
<Condition Property="IsChecked" Value="False"/>
|
2020-07-03 00:24:31 -07:00
|
|
|
</MultiTrigger.Conditions>
|
|
|
|
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.Accent2}"/>
|
|
|
|
</MultiTrigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
|
2021-04-29 05:05:55 -07:00
|
|
|
<Style TargetType="{x:Type controls:TreeItem}" BasedOn="{StaticResource Style.TreeItem}"/>
|
|
|
|
|
|
|
|
<Style TargetType="{x:Type controls:Tree}">
|
2020-07-03 00:24:31 -07:00
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
|
|
<Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="True" />
|
|
|
|
<Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Standard" />
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
|
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
|
|
<Setter Property="ItemsPanel">
|
|
|
|
<Setter.Value>
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
<VirtualizingStackPanel IsItemsHost="True"/>
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
<Setter.Value>
|
2021-04-29 05:05:55 -07:00
|
|
|
<ControlTemplate TargetType="{x:Type controls:Tree}">
|
2020-07-03 00:24:31 -07:00
|
|
|
<Border Name="Border"
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderThickness="0"
|
|
|
|
CornerRadius="0"
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
2021-04-02 00:45:31 -07:00
|
|
|
<ScrollViewer CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
2020-07-03 00:24:31 -07:00
|
|
|
Focusable="False"
|
|
|
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
|
|
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
|
|
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
|
|
|
</ScrollViewer>
|
|
|
|
</Border>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
|
|
|
|
<Style.Triggers>
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
|
|
<Setter Property="Opacity" Value=".5"/>
|
|
|
|
</Trigger>
|
|
|
|
</Style.Triggers>
|
|
|
|
</Style>
|
|
|
|
</ResourceDictionary>
|