Skip to content

Fix: Add TemplateBindings to CornerRadius, BorderBrush and BorderThickness TemplateBindings and CornerRadius Dependency to SnackBar #3888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/MaterialDesignThemes.Wpf/Snackbar.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows.Media.Animation;
using System.ComponentModel;
using System.Windows.Media.Animation;
using System.Windows.Threading;

namespace MaterialDesignThemes.Wpf;
Expand Down Expand Up @@ -186,4 +187,15 @@ public SnackbarActionButtonPlacementMode ActionButtonPlacement
get => (SnackbarActionButtonPlacementMode)GetValue(ActionButtonPlacementProperty);
set => SetValue(ActionButtonPlacementProperty, value);
}

public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(
nameof(CornerRadius), typeof(Thickness), typeof(Snackbar), new PropertyMetadata(new Thickness(0)));

[Bindable(true)]
[Category("Appearance")]
public Thickness CornerRadius
{
get => (Thickness)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
<Setter Property="ActionButtonStyle" Value="{StaticResource MaterialDesignSnackbarActionButton}" />
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.SnackBar.Background}" />
<Setter Property="ClipToBounds" Value="True" />
<Setter Property="CornerRadius" Value="3" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Background}" />
<Setter Property="HorizontalAlignment" Value="Center" />
Expand Down Expand Up @@ -191,7 +192,9 @@
MinHeight="48"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
CornerRadius="3"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
SnapsToDevicePixels="True">
<ContentPresenter x:Name="ContentPresenter"
Margin="{TemplateBinding Padding}"
Expand Down
Loading