mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-06 03:24:59 +00:00
refactor<*>: rewrite all codes...
This commit is contained in:
parent
89ff8aa744
commit
30ab8ae954
342 changed files with 17208 additions and 19633 deletions
|
@ -1,12 +0,0 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style x:Key="Style.Border.Badge" TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="9"/>
|
||||
<Setter Property="Margin" Value="4,0"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Height" Value="18"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Badge}"/>
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
|
@ -1,10 +1,10 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- 无边框按钮(也是默认样式) -->
|
||||
<Style x:Key="Style.Button" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border1}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Opacity" Value=".8"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
|
||||
|
@ -28,28 +28,7 @@
|
|||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- 修改默认样式 -->
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource Style.Button}"/>
|
||||
|
||||
<!-- 无边框但显示Hover -->
|
||||
<Style x:Key="Style.Button.HighlightHover" BasedOn="{StaticResource Style.Button}" TargetType="{x:Type Button}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#40000000"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- 有边框 -->
|
||||
<Style x:Key="Style.Button.Bordered" BasedOn="{StaticResource Style.Button}" TargetType="{x:Type Button}">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border1}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="8,0"/>
|
||||
</Style>
|
||||
<Style x:Key="Style.Button.AccentBordered" BasedOn="{StaticResource Style.Button}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent1}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="8,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
|
@ -3,33 +3,30 @@
|
|||
|
||||
<Style x:Key="Style.DataGridCell" TargetType="{x:Type DataGridCell}">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
</Trigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True" />
|
||||
<Condition Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}}" Value="False" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
</MultiDataTrigger>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent1}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Style.DataGridRow" TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent2}"/>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent1}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsSelected" Value="False"/>
|
||||
<Condition Property="IsMouseOver" Value="True"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent2}"/>
|
||||
</MultiTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
|
|
43
src/Resources/Styles/IconButton.xaml
Normal file
43
src/Resources/Styles/IconButton.xaml
Normal file
|
@ -0,0 +1,43 @@
|
|||
<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">
|
||||
<Style TargetType="{x:Type controls:IconButton}">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Opacity" Value=".8"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:IconButton}">
|
||||
<Border
|
||||
x:Name="Border"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<Path
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Data="{TemplateBinding Icon}"/>
|
||||
</Border>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="{Binding HoverBackground, RelativeSource={RelativeSource AncestorType={x:Type controls:IconButton}}}"/>
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
|
@ -1,15 +0,0 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style x:Key="Style.Label" TargetType="{x:Type Label}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource Style.Label}"/>
|
||||
|
||||
<Style x:Key="Style.Label.GroupHeader" BasedOn="{StaticResource Style.Label}" TargetType="{x:Type Label}">
|
||||
<Setter Property="FontWeight" Value="DemiBold"/>
|
||||
<Setter Property="Opacity" Value=".5"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
25
src/Resources/Styles/ListBox.xaml
Normal file
25
src/Resources/Styles/ListBox.xaml
Normal file
|
@ -0,0 +1,25 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="{x:Type ListBox}">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/>
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBox}">
|
||||
<Border
|
||||
Margin="{TemplateBinding Margin}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ItemsPresenter/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
|
@ -1,8 +1,7 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style x:Key="Style.ListViewItem.Borderless" TargetType="{x:Type ListViewItem}">
|
||||
<Setter Property="Padding" Value="2"/>
|
||||
<Style TargetType="{x:Type ListViewItem}">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||
<Setter Property="Template">
|
||||
|
@ -29,15 +28,16 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Style.ListView.Borderless" TargetType="{x:Type ListView}">
|
||||
<Style TargetType="{x:Type ListView}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource Style.ListViewItem.Borderless}"/>
|
||||
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
|
@ -48,7 +48,10 @@
|
|||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListView}">
|
||||
<Border Name="Border" BorderThickness="0" Background="{TemplateBinding Background}">
|
||||
<Border
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
Background="{TemplateBinding Background}">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}">
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style x:Key="Style.Icon" TargetType="{x:Type Path}">
|
||||
<Setter Property="Width" Value="16"/>
|
||||
<Setter Property="Height" Value="16"/>
|
||||
<Style TargetType="{x:Type Path}">
|
||||
<Setter Property="Stretch" Value="Uniform"/>
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality"/>
|
||||
</Style>
|
||||
|
||||
<!-- 修改默认样式 -->
|
||||
<Style TargetType="{x:Type Path}" BasedOn="{StaticResource Style.Icon}"/>
|
||||
</ResourceDictionary>
|
|
@ -1,4 +1,4 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="{x:Type TabControl}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
|
@ -19,7 +19,10 @@
|
|||
KeyboardNavigation.TabNavigation="Local"
|
||||
KeyboardNavigation.DirectionalNavigation="Contained"
|
||||
KeyboardNavigation.TabIndex="2">
|
||||
<ContentPresenter x:Name="PART_SelectedContentHost" Margin="4" ContentSource="SelectedContent" />
|
||||
<ContentPresenter
|
||||
x:Name="PART_SelectedContentHost"
|
||||
Margin="4"
|
||||
ContentSource="SelectedContent"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
@ -28,24 +31,35 @@
|
|||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TabItem}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||
<Border x:Name="Border" Margin="0" BorderThickness="0,0,0,1.1" BorderBrush="Transparent" Opacity=".7">
|
||||
<ContentPresenter
|
||||
x:Name="ContentSite"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
TextElement.Foreground="{DynamicResource Brush.FG1}"
|
||||
TextElement.FontWeight="Bold"
|
||||
<Border
|
||||
x:Name="Border"
|
||||
BorderThickness="0,0,0,1"
|
||||
BorderBrush="Transparent">
|
||||
<ContentPresenter
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
ContentSource="Header"
|
||||
Margin="8,6"
|
||||
RecognizesAccessKey="True" />
|
||||
Margin="8,6">
|
||||
<ContentPresenter.Resources>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=IsSelected}" Value="True">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent1}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentPresenter.Resources>
|
||||
</ContentPresenter>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource Brush.Accent1}"/>
|
||||
<Setter TargetName="Border" Property="Opacity" Value="1"/>
|
||||
<Setter TargetName="ContentSite" Property="TextElement.Foreground" Value="{DynamicResource Brush.Accent1}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
|
|
28
src/Resources/Styles/TextBlock.xaml
Normal file
28
src/Resources/Styles/TextBlock.xaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Style.TextBlock.LineNumber" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="8,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Style.TextBlock.LineContent" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="4,0,0,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
|
@ -1,8 +1,6 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:helpers="clr-namespace:SourceGit.Helpers">
|
||||
|
||||
<!-- 错误Tooltip -->
|
||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
|
||||
<ControlTemplate x:Key="Template.Validation.Tooltip" TargetType="{x:Type ToolTip}">
|
||||
<Border x:Name="Root" Margin="5,0,0,0" Opacity="0" Padding="0,0,20,20" RenderTransformOrigin="0,0">
|
||||
<Border.RenderTransform>
|
||||
|
@ -48,7 +46,6 @@
|
|||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
<!-- 验证错误模板 -->
|
||||
<ControlTemplate x:Key="Template.Validation.Error">
|
||||
<AdornedElementPlaceholder x:Name="Target">
|
||||
<Border BorderBrush="#FFDB000C" BorderThickness="1" x:Name="root">
|
||||
|
@ -76,17 +73,18 @@
|
|||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<!-- 修改默认 -->
|
||||
<Style TargetType="{x:Type TextBox}">
|
||||
<Style x:Key="Style.TextBox" TargetType="{x:Type TextBox}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="CaretBrush" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border1}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Validation.ErrorTemplate" Value="{StaticResource Template.Validation.Error}"/>
|
||||
<Setter Property="helpers:TextBoxHelper.AutoScroll" Value="True"/>
|
||||
<Setter Property="ContextMenu">
|
||||
<Setter.Value>
|
||||
<ContextMenu>
|
||||
|
@ -99,19 +97,21 @@
|
|||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ScrollViewer x:Name="PART_ContentHost"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsTabStop="False"
|
||||
CanContentScroll="False"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ScrollViewer
|
||||
x:Name="PART_ContentHost"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsTabStop="False"
|
||||
CanContentScroll="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
|
@ -126,4 +126,7 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource Style.TextBox}"/>
|
||||
<Style TargetType="{x:Type controls:TextEdit}" BasedOn="{StaticResource Style.TextBox}"/>
|
||||
</ResourceDictionary>
|
|
@ -50,7 +50,7 @@
|
|||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Grid>
|
||||
<Grid Background="Transparent">
|
||||
<Path
|
||||
x:Name="Icon"
|
||||
Height="12"
|
||||
|
@ -70,7 +70,7 @@
|
|||
<Condition Property="IsChecked" Value="False"/>
|
||||
<Condition Property="IsMouseOver" Value="True"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Icon" Property="Fill" Value="{DynamicResource Brush.FG2}"/>
|
||||
<Setter TargetName="Icon" Property="Opacity" Value=".5"/>
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
@ -78,36 +78,6 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Style.ToggleButton.ListOrTree" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Grid Background="Transparent">
|
||||
<Path
|
||||
x:Name="Icon"
|
||||
Height="12"
|
||||
Width="12"
|
||||
Style="{DynamicResource Style.Icon}"
|
||||
Fill="Transparent"
|
||||
Stroke="{DynamicResource Brush.FG1}"
|
||||
StrokeThickness=".4"
|
||||
Data="{DynamicResource Icon.Tree}"/>
|
||||
</Grid>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="Icon" Property="Data" Value="{DynamicResource Icon.List}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Style.ToggleButton.SplitDirection" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:SourceGit.Converters"
|
||||
xmlns:helpers="clr-namespace:SourceGit.Helpers">
|
||||
|
||||
<converters:TreeViewItemDepthToMargin x:Key="Converter.TreeViewItemIndent" Indent="19"/>
|
||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
|
||||
|
||||
<Style x:Key="Style.TreeView.ToggleButton" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
|
@ -24,71 +21,7 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Style.TreeView.ItemContainerStyle" TargetType="{x:Type TreeViewItem}">
|
||||
<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="Padding" Value="{Binding Padding, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TreeViewItem}">
|
||||
<StackPanel>
|
||||
<Border x:Name="BG"
|
||||
Background="Transparent"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||||
<Grid
|
||||
Margin="{Binding Converter={StaticResource Converter.TreeViewItemIndent}, RelativeSource={x:Static RelativeSource.TemplatedParent}}"
|
||||
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}"
|
||||
ContentSource="Header"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</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="IsSelected" Value="True">
|
||||
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.Accent1}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition SourceName="BG" Property="IsMouseOver" Value="True"/>
|
||||
<Condition Property="IsSelected" Value="False"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.Accent2}"/>
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Style.TreeView.MultiSelectionItemContainerStyle" TargetType="{x:Type TreeViewItem}">
|
||||
<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}" />
|
||||
|
@ -97,7 +30,7 @@
|
|||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TreeViewItem}">
|
||||
<ControlTemplate TargetType="{x:Type controls:TreeItem}">
|
||||
<StackPanel>
|
||||
<Border
|
||||
x:Name="BG"
|
||||
|
@ -105,8 +38,7 @@
|
|||
BorderThickness="0"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||||
<Grid
|
||||
Margin="{Binding Converter={StaticResource Converter.TreeViewItemIndent}, RelativeSource={x:Static RelativeSource.TemplatedParent}}"
|
||||
<Grid
|
||||
VerticalAlignment="Stretch"
|
||||
Background="Transparent">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@ -137,13 +69,13 @@
|
|||
<Trigger Property="HasItems" Value="False">
|
||||
<Setter TargetName="Expander" Property="Visibility" Value="Hidden"/>
|
||||
</Trigger>
|
||||
<Trigger Property="helpers:TreeViewHelper.IsChecked" Value="True">
|
||||
<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="helpers:TreeViewHelper.IsChecked" Value="False"/>
|
||||
<Condition Property="IsChecked" Value="False"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.Accent2}"/>
|
||||
</MultiTrigger>
|
||||
|
@ -153,11 +85,12 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TreeView}">
|
||||
<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="ItemContainerStyle" Value="{StaticResource Style.TreeView.ItemContainerStyle}"/>
|
||||
<Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="True" />
|
||||
<Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Standard" />
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
||||
|
@ -172,7 +105,7 @@
|
|||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TreeView}">
|
||||
<ControlTemplate TargetType="{x:Type controls:Tree}">
|
||||
<Border Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderThickness="0"
|
Loading…
Add table
Add a link
Reference in a new issue