Skip to content

Commit c4a64c2

Browse files
committed
Merge pull request #200 from punker76/RecognizesAccessKey-for_Ripple
RecognizesAccessKey for Ripple
2 parents 8609fa7 + 2bcf04d commit c4a64c2

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

MainDemo.Wpf/Buttons.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@
144144
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0 16 0 0">
145145
<Button Style="{StaticResource MaterialDesignRaisedLightButton}" Margin="0 0 8 0" Width="100"
146146
ToolTip="Resource name: MaterialDesignRaisedLightButton">
147-
LIGHT
147+
_LIGHT
148148
</Button>
149149
<Button Style="{StaticResource MaterialDesignRaisedButton}" Margin="0 0 8 0" Width="100"
150150
ToolTip="Resource name: MaterialDesignRaisedButton">
151-
MID
151+
_MID
152152
</Button>
153153
<Button Style="{StaticResource MaterialDesignRaisedDarkButton}" Margin="0 0 8 0" Width="100"
154154
ToolTip="Resource name: MaterialDesignRaisedLightDarkButton">
155-
DARK
155+
_DARK
156156
</Button>
157157
<Button Style="{StaticResource MaterialDesignRaisedAccentButton}" Margin="0 0 8 0" Width="100"
158158
ToolTip="Resource name: MaterialDesignRaisedAccentButton">

MaterialDesignThemes.Wpf/Ripple.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,25 @@ public double RippleY
140140
{
141141
get { return (double)GetValue(RippleYProperty); }
142142
private set { SetValue(RippleYPropertyKey, value); }
143-
}
143+
}
144+
145+
/// <summary>
146+
/// The DependencyProperty for the RecognizesAccessKey property.
147+
/// Default Value: false
148+
/// </summary>
149+
public static readonly DependencyProperty RecognizesAccessKeyProperty =
150+
DependencyProperty.Register(
151+
"RecognizesAccessKey", typeof(bool), typeof(Ripple),
152+
new PropertyMetadata(default(bool)));
153+
154+
/// <summary>
155+
/// Determine if Ripple should use AccessText in its style
156+
/// </summary>
157+
public bool RecognizesAccessKey
158+
{
159+
get { return (bool)GetValue(RecognizesAccessKeyProperty); }
160+
set { SetValue(RecognizesAccessKeyProperty, value); }
161+
}
144162

145163
public override void OnApplyTemplate()
146164
{

MaterialDesignThemes.Wpf/Themes/Generic.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<converters:DrawerOffsetConverter x:Key="DrawerOffsetConverter" />
3333

3434
<Style TargetType="{x:Type local:Ripple}">
35+
<Setter Property="RecognizesAccessKey" Value="True" />
3536
<Setter Property="HorizontalAlignment" Value="Stretch" />
3637
<Setter Property="VerticalAlignment" Value="Stretch" />
3738
<Setter Property="Background" Value="Transparent" />
@@ -133,11 +134,14 @@
133134
</Ellipse>
134135
</Canvas>
135136
<ContentPresenter Content="{TemplateBinding Content}"
137+
ContentStringFormat="{TemplateBinding ContentStringFormat}"
136138
ContentTemplate="{TemplateBinding ContentTemplate}"
137139
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
138140
Margin="{TemplateBinding Padding}"
139141
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
140-
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
142+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
143+
RecognizesAccessKey="{TemplateBinding RecognizesAccessKey}"
144+
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
141145
</Grid>
142146
</ControlTemplate>
143147
</Setter.Value>

0 commit comments

Comments
 (0)