Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix Card clipping issue
Fixes issue where Card.ContentClip was not correctly updated based on changes to the UniformCornerRadius.
  • Loading branch information
nicolaihenriksen committed Apr 2, 2023
commit dbe3a64923927e907bb9909d692d67fcb2f227be
13 changes: 12 additions & 1 deletion MaterialDesignThemes.Wpf/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ public double UniformCornerRadius
}
public static readonly DependencyProperty UniformCornerRadiusProperty
= DependencyProperty.Register(nameof(UniformCornerRadius), typeof(double), typeof(Card),
new FrameworkPropertyMetadata(DefaultUniformCornerRadius, FrameworkPropertyMetadataOptions.AffectsMeasure));
new FrameworkPropertyMetadata(DefaultUniformCornerRadius, FrameworkPropertyMetadataOptions.AffectsMeasure, UniformCornerRadiusChangedCallback));

private static void UniformCornerRadiusChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Card card = (Card) d;
card.UpdateContentClip();
}

#endregion

#region DependencyProperty : ContentClipProperty
Expand Down Expand Up @@ -59,7 +66,11 @@ public override void OnApplyTemplate()
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
{
base.OnRenderSizeChanged(sizeInfo);
UpdateContentClip();
}

private void UpdateContentClip()
{
if (_clipBorder is null)
{
return;
Expand Down