mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-04 12:43:25 -08:00
135 lines
No EOL
7.8 KiB
XML
135 lines
No EOL
7.8 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
|
xmlns:models="clr-namespace:SourceGit.Models">
|
|
|
|
<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">
|
|
<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"/>
|
|
</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>
|
|
|
|
<Style x:Key="Style.TreeItem" TargetType="{x:Type controls:TreeItem}">
|
|
<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"/>
|
|
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type controls:TreeItem}">
|
|
<StackPanel>
|
|
<Border
|
|
x:Name="BG"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
Padding="{TemplateBinding Padding}"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
|
<Grid
|
|
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}"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
ContentSource="Header"/>
|
|
</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>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.Accent1}"/>
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition SourceName="BG" Property="IsMouseOver" Value="True"/>
|
|
<Condition Property="IsChecked" Value="False"/>
|
|
</MultiTrigger.Conditions>
|
|
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.Accent2}"/>
|
|
</MultiTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type controls:TreeItem}" BasedOn="{StaticResource Style.TreeItem}"/>
|
|
|
|
<Style TargetType="{x:Type controls:Tree}">
|
|
<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="TextElement.FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
|
|
<Setter Property="ItemsPanel">
|
|
<Setter.Value>
|
|
<ItemsPanelTemplate>
|
|
<VirtualizingStackPanel IsItemsHost="True"/>
|
|
</ItemsPanelTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type controls:Tree}">
|
|
<Border Name="Border"
|
|
Background="{TemplateBinding Background}"
|
|
BorderThickness="0"
|
|
CornerRadius="0"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
|
<ScrollViewer CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
|
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> |