Skip to content

Commit 993b4d0

Browse files
committed
more multi action button
1 parent 2155fcb commit 993b4d0

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

MainDemo.Wpf/Home.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@
136136
HorizontalAlignment="Right" VerticalAlignment="Bottom"
137137
Margin="32">
138138
<ItemsControl>
139-
<Button>Hello</Button>
140-
<Button>World</Button>
139+
<Button ToolTip="Mail">@</Button>
140+
<Button ToolTip="Hashtag">#</Button>
141141
</ItemsControl>
142142
</materialDesign:PopupBox>
143143
</Grid>

MaterialDesignThemes.Wpf/Themes/Generic.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
<Setter Property="Background" Value="Transparent" />
3737
<Setter Property="IsTabStop" Value="False" />
3838
<Setter Property="ClipToBounds" Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:RippleAssist.ClipToBounds)}" />
39-
<Setter Property="local:RippleAssist.IsCentered" Value="True" />
4039
<Setter Property="Feedback" Value="{Binding RelativeSource={RelativeSource Self}, Path=Foreground}" />
4140
<Setter Property="Template">
4241
<Setter.Value>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.PopupBox.xaml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<ControlTemplate TargetType="ToggleButton">
2626
<wpf:Ripple Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Focusable="False"
2727
ClipToBounds="False"
28+
wpf:RippleAssist.IsCentered="True"
2829
Feedback="{DynamicResource MaterialDesignFlatButtonRipple}"
2930
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
3031
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
@@ -50,7 +51,7 @@
5051
PopupAnimation="Fade"
5152
AllowsTransparency="True">
5253
<wpf:Card Content="{TemplateBinding PopupContent}" ContentTemplate="{TemplateBinding PopupContentTemplate}"
53-
Margin="5" />
54+
Margin="5" />
5455
</controlz:PopupEx>
5556
</Grid>
5657
</ControlTemplate>
@@ -129,6 +130,7 @@
129130
<wpf:Ripple Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Focusable="False"
130131
Feedback="White"
131132
Clip="{Binding ElementName=GeometryEllipse, Path=RenderedGeometry}" ClipToBounds="True"
133+
wpf:RippleAssist.IsCentered="True"
132134
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
133135
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
134136
Padding="{TemplateBinding Padding}"
@@ -171,8 +173,39 @@
171173
Placement="Custom"
172174
PopupAnimation="Fade"
173175
AllowsTransparency="True">
174-
<wpf:Card Content="{TemplateBinding PopupContent}" ContentTemplate="{TemplateBinding PopupContentTemplate}"
175-
Margin="5" Padding="8" />
176+
<wpf:Card Content="{TemplateBinding PopupContent}" ContentTemplate="{TemplateBinding PopupContentTemplate}"
177+
Margin="5" Padding="8">
178+
<wpf:Card.Resources>
179+
<ResourceDictionary>
180+
<Style TargetType="{x:Type Button}">
181+
<Style.Setters>
182+
<Setter Property="Background" Value="{DynamicResource MaterialDesignPrimaryLightBrush}" />
183+
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignPrimaryLightForegroundBrush}" />
184+
<Setter Property="ToolTipService.IsEnabled" Value="False" />
185+
<Setter Property="Template">
186+
<Setter.Value>
187+
<ControlTemplate TargetType="{x:Type Button}">
188+
<StackPanel Orientation="Horizontal" Margin="8">
189+
<Grid Clip="{Binding ElementName=UncheckedEllipse, Path=RenderedGeometry}" ClipToBounds="True" Background="{TemplateBinding Background}"
190+
Width="30" Height="30">
191+
<Ellipse Fill="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" x:Name="UncheckedEllipse" />
192+
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
193+
</Grid>
194+
<Border Background="{DynamicResource MaterialDesignToolTipBackground}" Margin="8 0 0 0" Padding="8">
195+
<ContentControl Foreground="{DynamicResource MaterialDesignPaper}" Content="{TemplateBinding ToolTip}" VerticalAlignment="Center" />
196+
</Border>
197+
</StackPanel>
198+
</ControlTemplate>
199+
</Setter.Value>
200+
</Setter>
201+
</Style.Setters>
202+
</Style>
203+
</ResourceDictionary>
204+
</wpf:Card.Resources>
205+
<wpf:Card.Background>
206+
<SolidColorBrush Color="White" Opacity=".6" />
207+
</wpf:Card.Background>
208+
</wpf:Card>
176209
</controlz:PopupEx>
177210
</Grid>
178211
</ControlTemplate>

0 commit comments

Comments
 (0)