Skip to content

Commit

Permalink
Fix issue with ContentDialog not respecting BorderThickness property …
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Jun 19, 2020
1 parent 2593fa7 commit 7f01132
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
3 changes: 2 additions & 1 deletion ModernWpf.Controls/ContentDialog/ContentDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<Style TargetType="local:ContentDialog">
<Setter Property="Foreground" Value="{DynamicResource ContentDialogForeground}" />
<Setter Property="Background" Value="{DynamicResource ContentDialogBackground}" />
<Setter Property="BorderThickness" Value="{DynamicResource ContentDialogBorderWidth}" />
<Setter Property="BorderBrush" Value="{DynamicResource ContentDialogBorderBrush}" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
Expand Down Expand Up @@ -280,7 +281,7 @@
Margin="{DynamicResource ContentDialogBorderWidth}" />
<Border
Background="{TemplateBinding Background}"
BorderThickness="{DynamicResource ContentDialogBorderWidth}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="{TemplateBinding CornerRadius}">
<Border
Expand Down
10 changes: 3 additions & 7 deletions test/ModernWpfTestApp/ContentDialogPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@
xmlns:controls="http://schemas.modernwpf.com/2019"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel
Background="{DynamicResource SystemControlPageBackgroundAltHighBrush}"
Margin="12">
<Button
Content="Click to open simple ContentDialog"
Click="ShowDialog_Click" />
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="12">
<Button Content="Click to open simple ContentDialog" Click="ShowDialog_Click"/>
<Button Content="Border thickness test dialog" Click="ShowBorderThickness_Click"/>
</StackPanel>
</local:TestPage>
14 changes: 14 additions & 0 deletions test/ModernWpfTestApp/ContentDialogPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;

namespace MUXControlsTestApp
Expand Down Expand Up @@ -35,6 +36,19 @@ private async void ShowDialog_Click(object sender, RoutedEventArgs e)
Debug.WriteLine(result);
}

private void ShowBorderThickness_Click(object sender, RoutedEventArgs e)
{
var dialog = new ContentDialog {
Title = "Title",
Content = "I am testing border thickness",
IsPrimaryButtonEnabled = true,
BorderThickness = new Thickness(10, 20, 10, 20),
CloseButtonText = "CloseButton",
BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0))
};
_ = dialog.ShowAsync();
}

private void Dialog_Opened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
Debug.WriteLine("Opened");
Expand Down

0 comments on commit 7f01132

Please sign in to comment.