Skip to content

Commit 08bff44

Browse files
Add DialogHost.DialogContentUniformCornerRadius (#3103)
* Add DialogHost.DialogContentUniformCornerRadius Allows users of DialogHost to specify a custom (uniform) corner radius for the nested Card * Update MaterialDesignThemes.Wpf/DialogHost.cs --------- Co-authored-by: Kevin B <[email protected]>
1 parent 8c70516 commit 08bff44

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

MainDemo.Wpf/Dialogs.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
UniqueKey="dialogs_sample1">
6363
<materialDesign:DialogHost DialogClosed="Sample1_DialogHost_OnDialogClosed"
6464
DialogClosing="Sample1_DialogHost_OnDialogClosing"
65-
DialogTheme="Inherit">
65+
DialogTheme="Inherit"
66+
DialogContentUniformCornerRadius="20">
6667
<materialDesign:DialogHost.DialogContent>
6768
<StackPanel Margin="16">
6869
<TextBlock Text="Add a new fruit." />

MaterialDesignThemes.Wpf/DialogHost.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,15 @@ public object? DialogContent
432432
set => SetValue(DialogContentProperty, value);
433433
}
434434

435+
public static readonly DependencyProperty DialogContentUniformCornerRadiusProperty = DependencyProperty.Register(
436+
nameof(DialogContentUniformCornerRadius), typeof(double), typeof(DialogHost), new PropertyMetadata(4d));
437+
438+
public double DialogContentUniformCornerRadius
439+
{
440+
get => (double)GetValue(DialogContentUniformCornerRadiusProperty);
441+
set => SetValue(DialogContentUniformCornerRadiusProperty, value);
442+
}
443+
435444
public static readonly DependencyProperty DialogContentTemplateProperty = DependencyProperty.Register(
436445
nameof(DialogContentTemplate), typeof(DataTemplate), typeof(DialogHost), new PropertyMetadata(default(DataTemplate)));
437446

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DialogHost.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
RenderTransformOrigin=".5,.5"
174174
Tag="{TemplateBinding DialogBackground}"
175175
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
176-
UniformCornerRadius="4">
176+
UniformCornerRadius="{TemplateBinding DialogContentUniformCornerRadius}">
177177
<wpf:Card.Style>
178178
<Style TargetType="wpf:Card" BasedOn="{StaticResource {x:Type wpf:Card}}">
179179
<Setter Property="Background" Value="{Binding Tag, RelativeSource={RelativeSource Self}}" />
@@ -418,7 +418,7 @@
418418
RenderTransformOrigin=".5,.5"
419419
Tag="{TemplateBinding DialogBackground}"
420420
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
421-
UniformCornerRadius="4">
421+
UniformCornerRadius="{TemplateBinding DialogContentUniformCornerRadius}">
422422
<wpf:Card.RenderTransform>
423423
<TransformGroup>
424424
<ScaleTransform x:Name="CardScaleTransform" ScaleX="0" ScaleY="0" />
@@ -478,4 +478,4 @@
478478
</Trigger>
479479
</Style.Triggers>
480480
</Style>
481-
</ResourceDictionary>
481+
</ResourceDictionary>

0 commit comments

Comments
 (0)