Skip to content
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

Added UniformCornerRadius to Flipper #2758

Merged
merged 1 commit into from
Jul 5, 2022
Merged
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
56 changes: 56 additions & 0 deletions MainDemo.Wpf/Cards.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,62 @@
</materialDesign:Flipper.BackContent>
</materialDesign:Flipper>
</smtx:XamlDisplay>

<StackPanel>
<smtx:XamlDisplay
UniqueKey="cards_10"
Margin="4 4 0 0"
VerticalContentAlignment="Top">
<materialDesign:Flipper
IsFlippedChanged="Flipper_OnIsFlippedChanged">
<materialDesign:Flipper.FrontContent>
<Button
Style="{StaticResource MaterialDesignFlatButton}"
materialDesign:ButtonAssist.CornerRadius="8"
Command="{x:Static materialDesign:Flipper.FlipCommand}"
Margin="8"
Width="184"
Content="Rounded Flipper"/>
</materialDesign:Flipper.FrontContent>
<materialDesign:Flipper.BackContent>
<Button
Style="{StaticResource MaterialDesignFlatButton}"
materialDesign:ButtonAssist.CornerRadius="8"
Command="{x:Static materialDesign:Flipper.FlipCommand}"
Margin="8"
Width="184"
Content="GO BACK"/>
</materialDesign:Flipper.BackContent>
</materialDesign:Flipper>
</smtx:XamlDisplay>

<smtx:XamlDisplay
UniqueKey="cards_11"
Margin="4 4 0 0"
VerticalContentAlignment="Top">
<materialDesign:Flipper
Style="{StaticResource MaterialDesignCardFlipper}"
IsFlippedChanged="Flipper_OnIsFlippedChanged"
UniformCornerRadius="8">
<materialDesign:Flipper.FrontContent>
<Button
Style="{StaticResource MaterialDesignFlatButton}"
Command="{x:Static materialDesign:Flipper.FlipCommand}"
Margin="8"
Width="184"
Content="Rounded Card Flipper"/>
</materialDesign:Flipper.FrontContent>
<materialDesign:Flipper.BackContent>
<Button
Style="{StaticResource MaterialDesignFlatButton}"
Command="{x:Static materialDesign:Flipper.FlipCommand}"
Margin="8"
Width="184"
Content="GO BACK"/>
</materialDesign:Flipper.BackContent>
</materialDesign:Flipper>
</smtx:XamlDisplay>
</StackPanel>
</WrapPanel>
</UserControl>

12 changes: 12 additions & 0 deletions MaterialDesignThemes.Wpf/Flipper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ private static void OnIsFlippedChanged(
instance.RaiseEvent(args);
}

public static readonly DependencyProperty UniformCornerRadiusProperty = DependencyProperty.Register(
nameof(UniformCornerRadius), typeof(double), typeof(Flipper), new PropertyMetadata(default(double)));

/// <summary>
/// Gets or sets the (uniform) corner radius applied the the <see cref="Flipper"/> when the MaterialDesignCardFlipper style is applied.
/// </summary>
public double UniformCornerRadius
{
get => (double)GetValue(UniformCornerRadiusProperty);
set => SetValue(UniformCornerRadiusProperty, value);
}

public override void OnApplyTemplate()
{
base.OnApplyTemplate();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf">

Expand Down Expand Up @@ -162,7 +162,7 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<wpf:Plane3D x:Name="PART_Plane3D" RotationY="0" ZFactor="2.055">
<wpf:Card wpf:ShadowAssist.ShadowDepth="{TemplateBinding wpf:ShadowAssist.ShadowDepth}">
<wpf:Card wpf:ShadowAssist.ShadowDepth="{TemplateBinding wpf:ShadowAssist.ShadowDepth}" UniformCornerRadius="{TemplateBinding UniformCornerRadius}">
<Grid>
<ContentPresenter x:Name="FrontContentPresenter"
Margin="{TemplateBinding Padding}"
Expand Down