Skip to content
Merged
Show file tree
Hide file tree
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
Next Next commit
Add DialogHost.DialogContentUniformCornerRadius
Allows users of DialogHost to specify a custom (uniform) corner radius for the nested Card
  • Loading branch information
nicolaihenriksen committed Feb 24, 2023
commit 8fe4db11ad6c442d7cf77e98deb72fff880246f3
3 changes: 2 additions & 1 deletion MainDemo.Wpf/Dialogs.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
UniqueKey="dialogs_sample1">
<materialDesign:DialogHost DialogClosed="Sample1_DialogHost_OnDialogClosed"
DialogClosing="Sample1_DialogHost_OnDialogClosing"
DialogTheme="Inherit">
DialogTheme="Inherit"
DialogContentUniformCornerRadius="20">
<materialDesign:DialogHost.DialogContent>
<StackPanel Margin="16">
<TextBlock Text="Add a new fruit." />
Expand Down
9 changes: 9 additions & 0 deletions MaterialDesignThemes.Wpf/DialogHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,15 @@ public object? DialogContent
set => SetValue(DialogContentProperty, value);
}

public static readonly DependencyProperty DialogContentUniformCornerRadiusProperty = DependencyProperty.Register(
nameof(DialogContentUniformCornerRadius), typeof(double), typeof(DialogHost), new PropertyMetadata(4d));

public double DialogContentUniformCornerRadius
{
get { return (double)GetValue(DialogContentUniformCornerRadiusProperty); }
set { SetValue(DialogContentUniformCornerRadiusProperty, value); }
}

public static readonly DependencyProperty DialogContentTemplateProperty = DependencyProperty.Register(
nameof(DialogContentTemplate), typeof(DataTemplate), typeof(DialogHost), new PropertyMetadata(default(DataTemplate)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
RenderTransformOrigin=".5,.5"
Tag="{TemplateBinding DialogBackground}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
UniformCornerRadius="4">
UniformCornerRadius="{TemplateBinding DialogContentUniformCornerRadius}">
<wpf:Card.Style>
<Style TargetType="wpf:Card" BasedOn="{StaticResource {x:Type wpf:Card}}">
<Setter Property="Background" Value="{Binding Tag, RelativeSource={RelativeSource Self}}" />
Expand Down Expand Up @@ -418,7 +418,7 @@
RenderTransformOrigin=".5,.5"
Tag="{TemplateBinding DialogBackground}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
UniformCornerRadius="4">
UniformCornerRadius="{TemplateBinding DialogContentUniformCornerRadius}">
<wpf:Card.RenderTransform>
<TransformGroup>
<ScaleTransform x:Name="CardScaleTransform" ScaleX="0" ScaleY="0" />
Expand Down Expand Up @@ -478,4 +478,4 @@
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</ResourceDictionary>