Skip to content
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
21 changes: 19 additions & 2 deletions src/Wpf.Ui/Controls/MessageBox/MessageBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ public class MessageBox : System.Windows.Window
new PropertyMetadata(true)
);

/// <summary>Identifies the <see cref="IsCloseButtonEnabled"/> dependency property.</summary>
public static readonly DependencyProperty IsCloseButtonEnabledProperty = DependencyProperty.Register(
nameof(IsCloseButtonEnabled),
typeof(bool),
typeof(MessageBox),
new PropertyMetadata(true)
);

/// <summary>Identifies the <see cref="TemplateButtonCommand"/> dependency property.</summary>
public static readonly DependencyProperty TemplateButtonCommandProperty = DependencyProperty.Register(
nameof(TemplateButtonCommand),
Expand Down Expand Up @@ -214,7 +222,16 @@ public ControlAppearance CloseButtonAppearance
}

/// <summary>
/// Gets or sets a value indicating whether the <see cref="MessageBox"/> primary button is enabled.
/// Gets or sets a value indicating whether the <see cref="MessageBox"/> close button is enabled.
/// </summary>
public bool IsCloseButtonEnabled
{
get => (bool)GetValue(IsCloseButtonEnabledProperty);
set => SetValue(IsCloseButtonEnabledProperty, value);
}

/// <summary>
/// Gets or sets a value indicating whether the <see cref="MessageBox"/> secondary button is enabled.
/// </summary>
public bool IsSecondaryButtonEnabled
{
Expand All @@ -223,7 +240,7 @@ public bool IsSecondaryButtonEnabled
}

/// <summary>
/// Gets or sets a value indicating whether the <see cref="MessageBox"/> secondary button is enabled.
/// Gets or sets a value indicating whether the <see cref="MessageBox"/> primary button is enabled.
/// </summary>
public bool IsPrimaryButtonEnabled
{
Expand Down
8 changes: 7 additions & 1 deletion src/Wpf.Ui/Controls/MessageBox/MessageBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{DynamicResource MessageBoxBackground}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="12" />
<Setter Property="Foreground" Value="{DynamicResource MessageBoxForeground}" />
<Setter Property="TextElement.FontWeight" Value="Regular" />
<Setter Property="WindowStyle" Value="ToolWindow" />
Expand Down Expand Up @@ -84,7 +85,7 @@

<Border
Grid.Row="2"
Padding="12"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
BorderBrush="{DynamicResource MessageBoxSeparatorBorderBrush}"
Expand Down Expand Up @@ -138,6 +139,7 @@
</Trigger>
<Trigger Property="IsPrimaryButtonEnabled" Value="False">
<Setter TargetName="PrimaryColumn" Property="Width" Value="0" />
<Setter TargetName="FirstSpacer" Property="Width" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
Expand All @@ -152,6 +154,10 @@
<Setter TargetName="FirstSpacer" Property="Width" Value="0" />
<Setter TargetName="SecondaryColumn" Property="Width" Value="0" />
</Trigger>
<Trigger Property="IsCloseButtonEnabled" Value="False">
<Setter TargetName="CloseColumn" Property="Width" Value="0" />
<Setter TargetName="SecondSpacer" Property="Width" Value="0" />
</Trigger>
<Trigger Property="PrimaryButtonText" Value="">
<Setter Property="IsPrimaryButtonEnabled" Value="False" />
</Trigger>
Expand Down
Loading