Skip to content

Commit 94b4cc9

Browse files
author
bebenins
committed
Changes to ToolBar to make it closer to MD
- Changed ToolBar and ToolBarTray background to match MD - Tweaked MaterialDesignToolToggleFlatListBox to flawlessly integrate into ToolBar - Tweaked ToolBar Button style to match.
1 parent 62e4d60 commit 94b4cc9

8 files changed

+74
-73
lines changed

MainDemo.Wpf/Buttons.xaml

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -302,49 +302,6 @@
302302
<materialDesign:PackIcon Kind="FormatAlignJustify"/>
303303
</ListBoxItem>
304304
</ListBox>
305-
306-
<ListBox Grid.Column="1" Grid.Row="1" Style="{StaticResource MaterialDesignToolToggleFlatListBox}" SelectedIndex="0">
307-
<ListBox.ToolTip>
308-
<StackPanel>
309-
<TextBlock Text="MaterialDesignToolToggleFlatListBox" />
310-
<TextBlock Text="Exclusive selection" />
311-
<TextBlock Text="ListBoxAssist.IsToggle allows more natural toggle behaviour" />
312-
</StackPanel>
313-
</ListBox.ToolTip>
314-
<ListBoxItem>
315-
<materialDesign:PackIcon Kind="FormatAlignLeft"/>
316-
</ListBoxItem>
317-
<ListBoxItem>
318-
<materialDesign:PackIcon Kind="FormatAlignCenter"/>
319-
</ListBoxItem>
320-
<ListBoxItem>
321-
<materialDesign:PackIcon Kind="FormatAlignRight"/>
322-
</ListBoxItem>
323-
<ListBoxItem>
324-
<materialDesign:PackIcon Kind="FormatAlignJustify"/>
325-
</ListBoxItem>
326-
</ListBox>
327-
328-
<ListBox Grid.Column="1" Grid.Row="2" Style="{StaticResource MaterialDesignToolToggleListBox}"
329-
SelectionMode="Extended"
330-
Margin="0 8 0 0">
331-
<ListBox.ToolTip>
332-
<StackPanel>
333-
<TextBlock Text="MaterialDesignToolToggleListBox" />
334-
<TextBlock Text="Multiple selection" />
335-
<TextBlock Text="ListBoxAssist.IsToggle allows more natural toggle behaviour" />
336-
</StackPanel>
337-
</ListBox.ToolTip>
338-
<ListBoxItem>
339-
<materialDesign:PackIcon Kind="FormatBold"/>
340-
</ListBoxItem>
341-
<ListBoxItem>
342-
<materialDesign:PackIcon Kind="FormatItalic"/>
343-
</ListBoxItem>
344-
<ListBoxItem x:Name="UnderlineCheckbox">
345-
<materialDesign:PackIcon Kind="FormatUnderline"/>
346-
</ListBoxItem>
347-
</ListBox>
348305
</Grid>
349306

350307
<Border Grid.Row="6" Margin="0 16 0 0" BorderThickness="0 1 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}" />

MainDemo.Wpf/MenusAndToolBars.xaml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,32 @@
6969
<Button Command="Paste" ToolTip="Paste some stuff" ToolBar.OverflowMode="AsNeeded">
7070
<materialDesign:PackIcon Kind="ContentPaste" />
7171
</Button>
72-
<Separator />
72+
<Separator/>
73+
<ListBox Style="{StaticResource MaterialDesignToolToggleFlatListBox}">
74+
<ListBoxItem ToolTip="This is a lonley toggle with TextBlock instead of icon">
75+
<TextBlock>W</TextBlock>
76+
</ListBoxItem>
77+
</ListBox>
78+
<Separator/>
79+
<ListBox SelectionMode="Extended" Style="{StaticResource MaterialDesignToolToggleFlatListBox}">
80+
<ListBox.ToolTip>
81+
<StackPanel>
82+
<TextBlock Text="MaterialDesignToolToggleListBox" />
83+
<TextBlock Text="Multiple selection" />
84+
<TextBlock Text="ListBoxAssist.IsToggle allows more natural toggle behaviour" />
85+
</StackPanel>
86+
</ListBox.ToolTip>
87+
<ListBoxItem>
88+
<materialDesign:PackIcon Kind="FormatBold"/>
89+
</ListBoxItem>
90+
<ListBoxItem>
91+
<materialDesign:PackIcon Kind="FormatItalic"/>
92+
</ListBoxItem>
93+
<ListBoxItem x:Name="UnderlineCheckbox">
94+
<materialDesign:PackIcon Kind="FormatUnderline"/>
95+
</ListBoxItem>
96+
</ListBox>
97+
<Separator/>
7398
<Label Content="Font size:" VerticalAlignment="Center"/>
7499
<ComboBox>
75100
<ComboBoxItem Content="10"/>
@@ -85,12 +110,7 @@
85110
</Button>
86111
<RadioButton GroupName="XXX" Content="Radio" />
87112
<RadioButton GroupName="XXX" Content="Ga Ga" />
88-
<ToggleButton>
89-
Switch
90-
</ToggleButton>
91-
<Menu>
92-
<MenuItem>Embedded menu</MenuItem>
93-
</Menu>
113+
<ToggleButton/>
94114
</ToolBar>
95115
</ToolBarTray>
96116

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<SolidColorBrush x:Key="MaterialDesignBackground" Color="#FF000000" po:Freeze="True" />
99
<SolidColorBrush x:Key="MaterialDesignPaper" Color="#FF303030" po:Freeze="True" />
1010
<SolidColorBrush x:Key="MaterialDesignCardBackground" Color="#FF424242" po:Freeze="True" />
11+
<SolidColorBrush x:Key="MaterialDesignToolBarBackground" Color="#FF212121" po:Freeze="True" />
1112
<SolidColorBrush x:Key="MaterialDesignBody" Color="#DDFFFFFF" po:Freeze="True" />
1213
<SolidColorBrush x:Key="MaterialDesignBodyLight" Color="#89FFFFFF" po:Freeze="True" />
1314
<SolidColorBrush x:Key="MaterialDesignColumnHeader" Color="#BCFFFFFF" po:Freeze="True" /><!-- 74% -->

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<SolidColorBrush x:Key="MaterialDesignBackground" Color="#FFFFFFFF" po:Freeze="True" />
99
<SolidColorBrush x:Key="MaterialDesignPaper" Color="#FFfafafa" po:Freeze="True" />
1010
<SolidColorBrush x:Key="MaterialDesignCardBackground" Color="#FFFFFFFF" po:Freeze="True" />
11+
<SolidColorBrush x:Key="MaterialDesignToolBarBackground" Color="#FFF5F5F5" po:Freeze="True" />
1112
<SolidColorBrush x:Key="MaterialDesignBody" Color="#DD000000" po:Freeze="True" />
1213
<SolidColorBrush x:Key="MaterialDesignBodyLight" Color="#89000000" po:Freeze="True" />
1314
<SolidColorBrush x:Key="MaterialDesignColumnHeader" Color="#BC000000" po:Freeze="True" /> <!-- 74% -->

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@
2626
<Setter Property="Background" Value="Transparent"/>
2727
<Setter Property="BorderThickness" Value="0"/>
2828
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignDivider}"/>
29-
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
29+
<Setter Property="TextBlock.FontWeight" Value="DemiBold"/>
30+
<Setter Property="TextBlock.FontSize" Value="18"/>
31+
<Setter Property="MinWidth" Value="54"/>
32+
<Setter Property="HorizontalContentAlignment" Value="Center"/>
3033
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
31-
<Setter Property="Padding" Value="14 6 14 6" />
34+
<Setter Property="Padding" Value="16" />
3235
<Setter Property="SnapsToDevicePixels" Value="True"/>
3336
<Setter Property="Template">
3437
<Setter.Value>
@@ -103,7 +106,7 @@
103106
</VisualState>
104107
</VisualStateGroup>
105108
</VisualStateManager.VisualStateGroups>
106-
<Grid Margin="0 0 -1 0">
109+
<Grid>
107110
<Border x:Name="MouseOverBorder"
108111
Opacity="0"
109112
Background="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}"/>
@@ -120,12 +123,11 @@
120123
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
121124
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
122125
Padding="{TemplateBinding Padding}">
123-
124126
</wpf:Ripple>
125127
<Border x:Name="SelectedBorder"
126128
Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ListBox}, Path=SelectionMode, Converter={StaticResource EqualityToVisibilityConverter}, ConverterParameter={x:Static SelectionMode.Extended}, Mode=OneWay}"
127129
Opacity="0"
128-
BorderThickness="1 0 1 0"
130+
BorderThickness="0"
129131
BorderBrush="{DynamicResource MaterialDesignDivider}" />
130132
</Grid>
131133
</Border>
@@ -178,7 +180,7 @@
178180
Background="{TemplateBinding Background}"
179181
SnapsToDevicePixels="true"
180182
Padding="{TemplateBinding Padding}">
181-
<wpf:Card wpf:ShadowAssist.ShadowDepth="{TemplateBinding wpf:ShadowAssist.ShadowDepth}" HorizontalAlignment="Left">
183+
<wpf:Card wpf:ShadowAssist.ShadowDepth="{TemplateBinding wpf:ShadowAssist.ShadowDepth}" HorizontalAlignment="Left" Background="{DynamicResource MaterialDesignToolBarBackground}">
182184
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
183185
</wpf:Card>
184186
</Border>
@@ -205,7 +207,7 @@
205207
<Setter Property="BorderThickness" Value="0"/>
206208
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
207209
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
208-
<Setter Property="Padding" Value="8" />
210+
<Setter Property="Padding" Value="8"/>
209211
<Setter Property="SnapsToDevicePixels" Value="True"/>
210212
<Setter Property="Template">
211213
<Setter.Value>
@@ -343,8 +345,7 @@
343345
</Setter>
344346
</Style>
345347

346-
<Style x:Key="MaterialDesignCardsListBox" TargetType="{x:Type ListBox}"
347-
BasedOn="{StaticResource MaterialDesignListBox}">
348+
<Style x:Key="MaterialDesignCardsListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignListBox}">
348349
<Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignCardsListBoxItem}"/>
349350
</Style>
350351

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Menu.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@
7676
<Setter Property="Template">
7777
<Setter.Value>
7878
<ControlTemplate TargetType="{x:Type MenuItem}">
79+
<ControlTemplate.Resources>
80+
<Style TargetType="{x:Type wpf:PackIcon}" >
81+
<Setter Property="Width" Value="16" />
82+
<Setter Property="Height" Value="16" />
83+
</Style>
84+
</ControlTemplate.Resources>
7985
<Grid ClipToBounds="True">
8086
<Border x:Name="templateRoot"
8187
BorderBrush="{TemplateBinding BorderBrush}"

0 commit comments

Comments
 (0)