Skip to content

Commit

Permalink
(MahAppsGH-3612) Added a new Style for the GridSplitter control
Browse files Browse the repository at this point in the history
- Added a new Style
- Make it the default Style
- Updated the SplitView-Example
  • Loading branch information
timunie authored and punker76 committed Sep 25, 2019
1 parent efceff2 commit 127ff54
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
Text="DisplayMode" />
<ComboBox Grid.Row="1"
Grid.Column="1"
Width="100"
Margin="2"
VerticalAlignment="Center"
SelectedValue="{Binding DisplayMode}">
Expand All @@ -78,7 +77,6 @@
Text="PanePlacement" />
<ComboBox Grid.Row="2"
Grid.Column="1"
Width="100"
Margin="2"
VerticalAlignment="Center"
SelectedValue="{Binding PanePlacement}">
Expand All @@ -105,8 +103,9 @@
<Grid>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" MinWidth="200" />
<ColumnDefinition Width="3" />
<ColumnDefinition Width="4*" MinWidth="100" />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
Expand All @@ -117,7 +116,7 @@

<Label Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.ColumnSpan="3"
HorizontalAlignment="Left"
Content="Simple SplitView example"
Style="{DynamicResource DescriptionHeaderStyle}" />
Expand All @@ -128,9 +127,11 @@
DataContext="{Binding ElementName=SimpleSplitview}"
Template="{StaticResource ConfigDataTemplate}" />

<GridSplitter Grid.Column="1" Grid.Row="1" ResizeBehavior="PreviousAndNext" />

<controls:SplitView x:Name="SimpleSplitview"
Grid.Row="1"
Grid.Column="1"
Grid.Column="2"
Margin="5"
DisplayMode="Inline"
IsPaneOpen="True"
Expand Down
5 changes: 5 additions & 0 deletions src/MahApps.Metro/MahApps.Metro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@
<Compile DependentUpon="%(Filename)" SubType="Code" Update="**\obj\**\*.g$(DefaultLanguageSourceExtension)" />
<Compile DependentUpon="%(Filename)" SubType="Designer" Update="**\*.xaml$(DefaultLanguageSourceExtension)" />
</ItemGroup>
<ItemGroup>
<None Update="Styles\Controls.GridSplitter">
<Generator>MSBuild:Compile</Generator>
</None>
</ItemGroup>
</Project>
22 changes: 22 additions & 0 deletions src/MahApps.Metro/Styles/Controls.GridSplitter.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Style x:Key="MahApps.Styles.GridSplitter.Preview" >
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Fill="{DynamicResource MahApps.Brushes.Black}" Opacity="0.5" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="MahApps.Styles.GridSplitter" TargetType="{x:Type GridSplitter}" >
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray8}" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="ShowsPreview" Value="True" />
<Setter Property="PreviewStyle" Value="{StaticResource MahApps.Styles.GridSplitter.Preview}" />
</Style>

</ResourceDictionary>
4 changes: 3 additions & 1 deletion src/MahApps.Metro/Styles/Controls.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.DatePicker.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.DataGrid.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Expander.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.GridSplitter.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.GroupBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ListBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.PasswordBox.xaml" />
Expand Down Expand Up @@ -116,5 +117,6 @@
<Style BasedOn="{StaticResource MahApps.Styles.StatusBar}" TargetType="StatusBar" />
<Style BasedOn="{StaticResource MahApps.Styles.StatusBarItem}" TargetType="StatusBarItem" />
<Style BasedOn="{StaticResource MahApps.Styles.ScrollViewer}" TargetType="ScrollViewer" />

<Style BasedOn="{StaticResource MahApps.Styles.GridSplitter}" TargetType="GridSplitter" />

</ResourceDictionary>

0 comments on commit 127ff54

Please sign in to comment.