Skip to content

Commit 752f0c6

Browse files
HedpE-Keboo
authored andcommitted
Add CornerRadius dependency to SnackBar and TemplateBinding
1 parent 90d66c8 commit 752f0c6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/MaterialDesignThemes.Wpf/Snackbar.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Windows.Media.Animation;
1+
using System.ComponentModel;
2+
using System.Windows.Media.Animation;
23
using System.Windows.Threading;
34

45
namespace MaterialDesignThemes.Wpf;
@@ -186,4 +187,15 @@ public SnackbarActionButtonPlacementMode ActionButtonPlacement
186187
get => (SnackbarActionButtonPlacementMode)GetValue(ActionButtonPlacementProperty);
187188
set => SetValue(ActionButtonPlacementProperty, value);
188189
}
190+
191+
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(
192+
nameof(CornerRadius), typeof(Thickness), typeof(Snackbar), new PropertyMetadata(new Thickness(0)));
193+
194+
[Bindable(true)]
195+
[Category("Appearance")]
196+
public Thickness CornerRadius
197+
{
198+
get => (Thickness)GetValue(CornerRadiusProperty);
199+
set => SetValue(CornerRadiusProperty, value);
200+
}
189201
}

src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Snackbar.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
<Setter Property="ActionButtonStyle" Value="{StaticResource MaterialDesignSnackbarActionButton}" />
131131
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.SnackBar.Background}" />
132132
<Setter Property="ClipToBounds" Value="True" />
133+
<Setter Property="CornerRadius" Value="3" />
133134
<Setter Property="FontSize" Value="14" />
134135
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Background}" />
135136
<Setter Property="HorizontalAlignment" Value="Center" />
@@ -191,9 +192,9 @@
191192
MinHeight="48"
192193
VerticalAlignment="Stretch"
193194
Background="{TemplateBinding Background}"
194-
CornerRadius="3"
195195
BorderBrush="{TemplateBinding BorderBrush}"
196196
BorderThickness="{TemplateBinding BorderThickness}"
197+
CornerRadius="{TemplateBinding CornerRadius}"
197198
SnapsToDevicePixels="True">
198199
<ContentPresenter x:Name="ContentPresenter"
199200
Margin="{TemplateBinding Padding}"

0 commit comments

Comments
 (0)