Skip to content

Commit ceba17b

Browse files
Added UniformCornerRadius to Flipper (#2758)
This DP is only used in the MaterialDesignCardFlipper style. For the default style, calling code can simply add rounded corners to the content that is put in.
1 parent 211cbe8 commit ceba17b

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed

MainDemo.Wpf/Cards.xaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,62 @@
551551
</materialDesign:Flipper.BackContent>
552552
</materialDesign:Flipper>
553553
</smtx:XamlDisplay>
554+
555+
<StackPanel>
556+
<smtx:XamlDisplay
557+
UniqueKey="cards_10"
558+
Margin="4 4 0 0"
559+
VerticalContentAlignment="Top">
560+
<materialDesign:Flipper
561+
IsFlippedChanged="Flipper_OnIsFlippedChanged">
562+
<materialDesign:Flipper.FrontContent>
563+
<Button
564+
Style="{StaticResource MaterialDesignFlatButton}"
565+
materialDesign:ButtonAssist.CornerRadius="8"
566+
Command="{x:Static materialDesign:Flipper.FlipCommand}"
567+
Margin="8"
568+
Width="184"
569+
Content="Rounded Flipper"/>
570+
</materialDesign:Flipper.FrontContent>
571+
<materialDesign:Flipper.BackContent>
572+
<Button
573+
Style="{StaticResource MaterialDesignFlatButton}"
574+
materialDesign:ButtonAssist.CornerRadius="8"
575+
Command="{x:Static materialDesign:Flipper.FlipCommand}"
576+
Margin="8"
577+
Width="184"
578+
Content="GO BACK"/>
579+
</materialDesign:Flipper.BackContent>
580+
</materialDesign:Flipper>
581+
</smtx:XamlDisplay>
582+
583+
<smtx:XamlDisplay
584+
UniqueKey="cards_11"
585+
Margin="4 4 0 0"
586+
VerticalContentAlignment="Top">
587+
<materialDesign:Flipper
588+
Style="{StaticResource MaterialDesignCardFlipper}"
589+
IsFlippedChanged="Flipper_OnIsFlippedChanged"
590+
UniformCornerRadius="8">
591+
<materialDesign:Flipper.FrontContent>
592+
<Button
593+
Style="{StaticResource MaterialDesignFlatButton}"
594+
Command="{x:Static materialDesign:Flipper.FlipCommand}"
595+
Margin="8"
596+
Width="184"
597+
Content="Rounded Card Flipper"/>
598+
</materialDesign:Flipper.FrontContent>
599+
<materialDesign:Flipper.BackContent>
600+
<Button
601+
Style="{StaticResource MaterialDesignFlatButton}"
602+
Command="{x:Static materialDesign:Flipper.FlipCommand}"
603+
Margin="8"
604+
Width="184"
605+
Content="GO BACK"/>
606+
</materialDesign:Flipper.BackContent>
607+
</materialDesign:Flipper>
608+
</smtx:XamlDisplay>
609+
</StackPanel>
554610
</WrapPanel>
555611
</UserControl>
556612

MaterialDesignThemes.Wpf/Flipper.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,18 @@ private static void OnIsFlippedChanged(
143143
instance.RaiseEvent(args);
144144
}
145145

146+
public static readonly DependencyProperty UniformCornerRadiusProperty = DependencyProperty.Register(
147+
nameof(UniformCornerRadius), typeof(double), typeof(Flipper), new PropertyMetadata(default(double)));
148+
149+
/// <summary>
150+
/// Gets or sets the (uniform) corner radius applied the the <see cref="Flipper"/> when the MaterialDesignCardFlipper style is applied.
151+
/// </summary>
152+
public double UniformCornerRadius
153+
{
154+
get => (double)GetValue(UniformCornerRadiusProperty);
155+
set => SetValue(UniformCornerRadiusProperty, value);
156+
}
157+
146158
public override void OnApplyTemplate()
147159
{
148160
base.OnApplyTemplate();

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Flipper.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf">
44

@@ -162,7 +162,7 @@
162162
</VisualStateGroup>
163163
</VisualStateManager.VisualStateGroups>
164164
<wpf:Plane3D x:Name="PART_Plane3D" RotationY="0" ZFactor="2.055">
165-
<wpf:Card wpf:ShadowAssist.ShadowDepth="{TemplateBinding wpf:ShadowAssist.ShadowDepth}">
165+
<wpf:Card wpf:ShadowAssist.ShadowDepth="{TemplateBinding wpf:ShadowAssist.ShadowDepth}" UniformCornerRadius="{TemplateBinding UniformCornerRadius}">
166166
<Grid>
167167
<ContentPresenter x:Name="FrontContentPresenter"
168168
Margin="{TemplateBinding Padding}"

0 commit comments

Comments
 (0)