Skip to content

Commit

Permalink
Remove duplicate definitions of GridSplitter style (#5963)
Browse files Browse the repository at this point in the history
  • Loading branch information
gave92 authored Aug 29, 2021
1 parent 4be1ee2 commit 278513f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 230 deletions.
34 changes: 19 additions & 15 deletions Files/ResourceDictionaries/DefaultGridSplitterStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<Setter Property="IsFocusEngagementEnabled" Value="True" />
<Setter Property="MinWidth" Value="2" />
<Setter Property="MinHeight" Value="2" />
<Setter Property="BorderBrush" Value="{ThemeResource SplitterBorderBrush}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="GripperForeground" Value="Transparent" />
<Setter Property="Template">
Expand All @@ -19,7 +20,7 @@
<Grid
x:Name="RootGrid"
Background="Transparent"
BorderBrush="{ThemeResource SystemBaseLowColor}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1,0,0,0">
<ContentPresenter
HorizontalContentAlignment="Stretch"
Expand All @@ -28,7 +29,11 @@
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="GridSplitterStates">
<VisualState x:Name="Normal" />

<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="Transparent" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="Transparent" />
Expand All @@ -42,26 +47,25 @@
</Setter>
</Style>

<Style x:Key="PaneGridSplitter" TargetType="controls:GridSplitter">
<Setter Property="IsTabStop" Value="True" />
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="IsFocusEngagementEnabled" Value="True" />
<Setter Property="MinWidth" Value="2" />
<Setter Property="MinHeight" Value="2" />
<Setter Property="Background" Value="{ThemeResource SystemBaseLowColor}" />
<Setter Property="GripperForeground" Value="{ThemeResource SystemBaseLowColor}" />
<Style
x:Key="InvisibleGridSplitterStyle"
BasedOn="{StaticResource DefaultGridSplitterStyle}"
TargetType="controls:GridSplitter">
<Setter Property="BorderBrush" Value="{ThemeResource TransparentSplitterBorderBrush}" />
</Style>

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="TransparentSplitterBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="SplitterBorderBrush" Color="{ThemeResource ControlStrokeColorDefault}" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="TransparentSplitterBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="SplitterBorderBrush" Color="{ThemeResource ControlStrokeColorDefault}" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="{ThemeResource SystemColorWindowTextColor}" />
<SolidColorBrush x:Key="TransparentSplitterBorderBrush" Color="{ThemeResource SystemColorWindowTextColor}" />
<SolidColorBrush x:Key="SplitterBorderBrush" Color="{ThemeResource SystemColorWindowTextColor}" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
1 change: 0 additions & 1 deletion Files/UserControls/PreviewPane.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ResourceDictionaries/DefaultGridSplitterStyle.xaml" />
<ResourceDictionary Source="ms-appx:///ResourceDictionaries/PropertiesStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Expand Down
59 changes: 0 additions & 59 deletions Files/Views/ColumnShellPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,65 +13,6 @@
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ResourceDictionaries/DefaultGridSplitterStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="Transparent" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="Transparent" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="{ThemeResource SystemColorWindowTextColor}" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

<Style x:Key="DefaultGridSplitterStyle" TargetType="Custom:GridSplitter">
<Setter Property="IsTabStop" Value="True" />
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="IsFocusEngagementEnabled" Value="True" />
<Setter Property="MinWidth" Value="2" />
<Setter Property="MinHeight" Value="2" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="GripperForeground" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Custom:GridSplitter">
<Grid
x:Name="RootGrid"
Background="Transparent"
BorderBrush="{ThemeResource SidebarBorderBrush}"
BorderThickness="1,0,0,0">
<ContentPresenter
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{TemplateBinding Element}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="GridSplitterStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="Transparent" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="Transparent" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<converters:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
Expand Down
51 changes: 5 additions & 46 deletions Files/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@
</Page.DataContext>
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///ResourceDictionaries/DefaultGridSplitterStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="{ThemeResource ControlStrokeColorDefault}" />
<SolidColorBrush x:Key="NavigationViewContentGridBorderBrush" Color="{ThemeResource ControlStrokeColorDefault}" />
<Thickness x:Key="NavigationViewContentGridBorderThickness">1,0,0,0</Thickness>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="{ThemeResource ControlStrokeColorDefault}" />
<SolidColorBrush x:Key="NavigationViewContentGridBorderBrush" Color="{ThemeResource ControlStrokeColorDefault}" />
<Thickness x:Key="NavigationViewContentGridBorderThickness">1,0,0,0</Thickness>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="{ThemeResource SystemColorWindowTextColor}" />
<SolidColorBrush x:Key="NavigationViewContentGridBorderBrush" Color="{ThemeResource ControlStrokeColorDefault}" />
<Thickness x:Key="NavigationViewContentGridBorderThickness">1,0,0,0</Thickness>
</ResourceDictionary>
Expand All @@ -46,48 +47,6 @@
<x:Boolean x:Key="True">True</x:Boolean>
<x:Boolean x:Key="False">False</x:Boolean>

<Style x:Key="DefaultGridSplitterStyle" TargetType="Custom:GridSplitter">
<Setter Property="IsTabStop" Value="True" />
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="IsFocusEngagementEnabled" Value="True" />
<Setter Property="MinWidth" Value="2" />
<Setter Property="MinHeight" Value="2" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="GripperForeground" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Custom:GridSplitter">
<Grid
x:Name="RootGrid"
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="1,0,0,0">
<ContentPresenter
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{TemplateBinding Element}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="GridSplitterStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="Transparent" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="Transparent" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<converters:WidthToRightMargin x:Key="WidthToRightMarginConverter" />
<converters1:BoolNegationConverter x:Key="BoolNegationConverter" />
</ResourceDictionary>
Expand Down Expand Up @@ -446,7 +405,7 @@
x:Load="{x:Bind LoadPreviewPane, Mode=OneWay}"
ManipulationCompleted="PreviewPaneGridSplitter_ManipulationCompleted"
ResizeBehavior="BasedOnAlignment"
Style="{StaticResource DefaultGridSplitterStyle}" />
Style="{StaticResource InvisibleGridSplitterStyle}" />

<controls:StatusBarControl
x:Name="StatusBarControl"
Expand Down
60 changes: 0 additions & 60 deletions Files/Views/ModernShellPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
x:Class="Files.Views.ModernShellPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Custom="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand All @@ -13,65 +12,6 @@
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ResourceDictionaries/DefaultGridSplitterStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="Transparent" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="Transparent" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="SidebarBorderBrush" Color="{ThemeResource SystemColorWindowTextColor}" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

<Style x:Key="DefaultGridSplitterStyle" TargetType="Custom:GridSplitter">
<Setter Property="IsTabStop" Value="True" />
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="IsFocusEngagementEnabled" Value="True" />
<Setter Property="MinWidth" Value="2" />
<Setter Property="MinHeight" Value="2" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="GripperForeground" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Custom:GridSplitter">
<Grid
x:Name="RootGrid"
Background="Transparent"
BorderBrush="{ThemeResource SidebarBorderBrush}"
BorderThickness="1,0,0,0">
<ContentPresenter
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{TemplateBinding Element}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="GridSplitterStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="Transparent" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="Transparent" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<converters:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
Expand Down
Loading

0 comments on commit 278513f

Please sign in to comment.