Skip to content

Commit 0f2396c

Browse files
committed
fix floating action button size and add mini variant. fixes #140
1 parent 993b4d0 commit 0f2396c

File tree

7 files changed

+79
-17
lines changed

7 files changed

+79
-17
lines changed

MahMaterialDragablzMashUp/Buttons.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@
1515
</Grid.RowDefinitions>
1616
<WrapPanel Grid.Row="0" Orientation="Horizontal" Margin="0 8 0 0">
1717
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" Margin="0 0 8 8" />
18-
<Button Style="{StaticResource MaterialDesignFloatingActionLightButton}" Margin="0 0 8 8" HorizontalAlignment="Left">
18+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}" Margin="0 0 8 8" HorizontalAlignment="Left">
1919
<Viewbox Width="24" Height="24">
2020
<Canvas Width="24" Height="24">
2121
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}, Path=Foreground}" />
2222
</Canvas>
2323
</Viewbox>
2424
</Button>
25-
<Button Style="{StaticResource MaterialDesignFloatingActionButton}" Margin="0 0 8 8" HorizontalAlignment="Left">
25+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniButton}" Margin="0 0 8 8" HorizontalAlignment="Left">
2626
<Viewbox Width="24" Height="24">
2727
<Canvas Width="24" Height="24">
2828
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}, Path=Foreground}" />
2929
</Canvas>
3030
</Viewbox>
3131
</Button>
32-
<Button Style="{StaticResource MaterialDesignFloatingActionDarkButton}" Margin="0 0 8 8" HorizontalAlignment="Left">
32+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}" Margin="0 0 8 8" HorizontalAlignment="Left">
3333
<Viewbox Width="24" Height="24">
3434
<Canvas Width="24" Height="24">
3535
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}, Path=Foreground}" />
3636
</Canvas>
3737
</Viewbox>
3838
</Button>
39-
<Button Style="{StaticResource MaterialDesignFloatingActionAccentButton}" Margin="0 0 8 8" HorizontalAlignment="Left">
39+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Margin="0 0 8 8" HorizontalAlignment="Left">
4040
<Viewbox Width="24" Height="24">
4141
<Canvas Width="24" Height="24">
4242
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}, Path=Foreground}" />

MahMaterialDragablzMashUp/Cards.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<TextBlock Text="{Binding StringFormat=m}" FontWeight="Bold" />
2626
<TextBlock Text="{Binding StringFormat=T}" />
2727
</StackPanel>
28-
<Button Style="{StaticResource MaterialDesignFloatingActionAccentButton}"
28+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
2929
Grid.Column="1" Margin="-20 0 0 0" HorizontalAlignment="Left">
3030
<Viewbox Width="24" Height="24">
3131
<Canvas Width="24" Height="24">

MainDemo.Wpf/Buttons.xaml

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,72 @@
3434
</Grid.RowDefinitions>
3535
<TextBlock>Buttons</TextBlock>
3636
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0 24 0 0">
37+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
38+
Margin="0 0 8 0" HorizontalAlignment="Left"
39+
ToolTip="MaterialDesignFloatingActionMiniLightButton">
40+
<Viewbox Width="24" Height="24">
41+
<Canvas Width="24" Height="24">
42+
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" />
43+
</Canvas>
44+
</Viewbox>
45+
</Button>
46+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniButton}"
47+
Margin="0 0 8 0" HorizontalAlignment="Left"
48+
ToolTip="MaterialDesignFloatingActionMiniButton">
49+
<Viewbox Width="24" Height="24">
50+
<Canvas Width="24" Height="24">
51+
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" />
52+
</Canvas>
53+
</Viewbox>
54+
</Button>
55+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
56+
Margin="0 0 8 0" HorizontalAlignment="Left"
57+
ToolTip="MaterialDesignFloatingActionMiniDarkButton">
58+
<Viewbox Width="24" Height="24">
59+
<Canvas Width="24" Height="24">
60+
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" />
61+
</Canvas>
62+
</Viewbox>
63+
</Button>
64+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
65+
Margin="0 0 8 0" HorizontalAlignment="Left"
66+
ToolTip="MaterialDesignFloatingActionMiniAccentButton">
67+
<Viewbox Width="24" Height="24">
68+
<Canvas Width="24" Height="24">
69+
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" />
70+
</Canvas>
71+
</Viewbox>
72+
</Button>
3773
<Button Style="{StaticResource MaterialDesignFloatingActionLightButton}"
3874
Margin="0 0 8 0" HorizontalAlignment="Left"
39-
ToolTip="X">
75+
ToolTip="MaterialDesignFloatingActionLightButton">
4076
<Viewbox Width="24" Height="24">
4177
<Canvas Width="24" Height="24">
4278
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" />
4379
</Canvas>
4480
</Viewbox>
4581
</Button>
4682
<Button Style="{StaticResource MaterialDesignFloatingActionButton}"
47-
Margin="0 0 8 0" HorizontalAlignment="Left">
83+
Margin="0 0 8 0" HorizontalAlignment="Left"
84+
ToolTip="MaterialDesignFloatingActionButton">
4885
<Viewbox Width="24" Height="24">
4986
<Canvas Width="24" Height="24">
5087
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" />
5188
</Canvas>
5289
</Viewbox>
5390
</Button>
5491
<Button Style="{StaticResource MaterialDesignFloatingActionDarkButton}"
55-
Margin="0 0 8 0" HorizontalAlignment="Left">
92+
Margin="0 0 8 0" HorizontalAlignment="Left"
93+
ToolTip="MaterialDesignFloatingActionDarkButton">
5694
<Viewbox Width="24" Height="24">
5795
<Canvas Width="24" Height="24">
5896
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" />
5997
</Canvas>
6098
</Viewbox>
6199
</Button>
62100
<Button Style="{StaticResource MaterialDesignFloatingActionAccentButton}"
63-
Margin="0 0 8 0" HorizontalAlignment="Left">
101+
Margin="0 0 8 0" HorizontalAlignment="Left"
102+
ToolTip="MaterialDesignFloatingActionAccentButton">
64103
<Viewbox Width="24" Height="24">
65104
<Canvas Width="24" Height="24">
66105
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" />

MainDemo.Wpf/Cards.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<RowDefinition Height="Auto" />
2424
</Grid.RowDefinitions>
2525
<Image Source="Resources/Chartridge046_small.jpg" Height="140" Width="196" Stretch="UniformToFill" />
26-
<Button Grid.Row="0" Style="{StaticResource MaterialDesignFloatingActionAccentButton}"
26+
<Button Grid.Row="0" Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
2727
HorizontalAlignment="Right" VerticalAlignment="Bottom"
2828
Margin="0 0 16 -20">
2929
<Viewbox Width="16" Height="16">

MainDemo.Wpf/Dialogs.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<materialDesign:ColorZone Mode="PrimaryMid" Grid.Row="1" Effect="{DynamicResource MaterialDesignShadowDepth5}">
8383
<TextBlock Margin="16">Fruit Bowl</TextBlock>
8484
</materialDesign:ColorZone>
85-
<Button Style="{StaticResource MaterialDesignFloatingActionAccentButton}"
85+
<Button Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
8686
Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"
8787
VerticalAlignment="Bottom" HorizontalAlignment="Right"
8888
Grid.Row="0" Margin="0 0 28 -20">

MainDemo.Wpf/Shadows.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@
2929
>DEPTH 5</Button>
3030
</StackPanel>
3131
<StackPanel Orientation="Horizontal" Margin="0 32 0 0">
32-
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}"
32+
<Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
3333
materialDesign:ShadowAssist.ShadowDepth="Depth1"
3434
>1</Button>
35-
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}"
35+
<Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
3636
Margin="16 0 0 0"
3737
materialDesign:ShadowAssist.ShadowDepth="Depth2"
3838
>2</Button>
39-
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}"
39+
<Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
4040
Margin="16 0 0 0"
4141
materialDesign:ShadowAssist.ShadowDepth="Depth3"
4242
>3</Button>
43-
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}"
43+
<Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
4444
Margin="16 0 0 0"
4545
materialDesign:ShadowAssist.ShadowDepth="Depth4"
4646
>4</Button>
47-
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}"
47+
<Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
4848
Margin="16 0 0 0"
4949
materialDesign:ShadowAssist.ShadowDepth="Depth5"
5050
>5</Button>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Button.xaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
221221
</Style>
222222

223-
<Style x:Key="MaterialDesignFloatingActionButton" TargetType="{x:Type Button}">
223+
<Style x:Key="MaterialDesignFloatingActionMiniButton" TargetType="{x:Type Button}">
224224
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
225225
<Setter Property="Background" Value="{DynamicResource PrimaryHueMidBrush}"/>
226226
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidBrush}"/>
@@ -265,6 +265,29 @@
265265
</Setter>
266266
</Style>
267267

268+
<Style x:Key="MaterialDesignFloatingActionButton" TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignFloatingActionMiniButton}">
269+
<Setter Property="Width" Value="56"/>
270+
<Setter Property="Height" Value="56"/>
271+
</Style>
272+
273+
<Style x:Key="MaterialDesignFloatingActionMiniLightButton" TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignFloatingActionMiniButton}">
274+
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}"/>
275+
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}"/>
276+
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueLightForegroundBrush}"/>
277+
</Style>
278+
279+
<Style x:Key="MaterialDesignFloatingActionMiniDarkButton" TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignFloatingActionMiniButton}">
280+
<Setter Property="Background" Value="{DynamicResource PrimaryHueDarkBrush}"/>
281+
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueDarkBrush}"/>
282+
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueDarkForegroundBrush}"/>
283+
</Style>
284+
285+
<Style x:Key="MaterialDesignFloatingActionMiniAccentButton" TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignFloatingActionMiniButton}">
286+
<Setter Property="Background" Value="{DynamicResource SecondaryAccentBrush}"/>
287+
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryAccentBrush}"/>
288+
<Setter Property="Foreground" Value="{DynamicResource SecondaryAccentForegroundBrush}"/>
289+
</Style>
290+
268291
<Style x:Key="MaterialDesignFloatingActionLightButton" TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignFloatingActionButton}">
269292
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}"/>
270293
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}"/>

0 commit comments

Comments
 (0)