Skip to content
Closed
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
3 changes: 2 additions & 1 deletion src/Wpf.Ui.Demo/Views/Container.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@
Title="WPF UI"
Grid.Row="0"
Grid.RowSpan="2"
ButtonLeftName="Click me if you can!" />
ButtonLeftName="Click me if you can!"
ButtonLeftIcon="FoodCarrot24" />

<!--
For debugging the focus and the keyboard navigation,
Expand Down
32 changes: 32 additions & 0 deletions src/Wpf.Ui/Controls/Dialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ public class Dialog : System.Windows.Controls.ContentControl, IDialogControl
typeof(Common.ControlAppearance), typeof(Dialog),
new PropertyMetadata(Common.ControlAppearance.Primary));

/// <summary>
/// Property for <see cref="ButtonLeftIconProperty"/>.
/// </summary>
public static readonly DependencyProperty ButtonLeftIconProperty = DependencyProperty.Register(
nameof(ButtonLeftIcon),
typeof(SymbolRegular), typeof(Dialog));

/// <summary>
/// Property for <see cref="ButtonLeftVisibility"/>.
/// </summary>
Expand All @@ -134,6 +141,13 @@ public class Dialog : System.Windows.Controls.ContentControl, IDialogControl
typeof(Common.ControlAppearance), typeof(Dialog),
new PropertyMetadata(Common.ControlAppearance.Secondary));

/// <summary>
/// Property for <see cref="ButtonRightAppearance"/>.
/// </summary>
public static readonly DependencyProperty ButtonRightIconProperty = DependencyProperty.Register(
nameof(ButtonRightIcon),
typeof(SymbolRegular), typeof(Dialog));

/// <summary>
/// Property for <see cref="ButtonRightVisibility"/>.
/// </summary>
Expand Down Expand Up @@ -209,6 +223,15 @@ public Common.ControlAppearance ButtonLeftAppearance
set => SetValue(ButtonLeftAppearanceProperty, value);
}

/// <summary>
/// Gets or sets the <see cref="SymbolRegular"/> of the button on the left.
/// </summary>
public SymbolRegular ButtonLeftIcon
{
get => (SymbolRegular)GetValue(ButtonLeftIconProperty);
set => SetValue(ButtonLeftIconProperty, value);
}

/// <summary>
/// Gets or sets the visibility of the button on the left.
/// </summary>
Expand Down Expand Up @@ -241,6 +264,15 @@ public Common.ControlAppearance ButtonRightAppearance
set => SetValue(ButtonRightAppearanceProperty, value);
}

/// <summary>
/// Gets or sets the <see cref="SymbolRegular"/> of the button on the right.
/// </summary>
public SymbolRegular ButtonRightIcon
{
get => (SymbolRegular)GetValue(ButtonRightIconProperty);
set => SetValue(ButtonRightIconProperty, value);
}

/// <summary>
/// Gets or sets the visibility of the button on the right.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Wpf.Ui/Styles/Controls/Dialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
Margin="0,0,4,0"
HorizontalAlignment="Stretch"
Appearance="{TemplateBinding ButtonLeftAppearance}"
Icon="{TemplateBinding ButtonLeftIcon}"
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
CommandParameter="left"
Content="{TemplateBinding ButtonLeftName}"
Expand All @@ -131,6 +132,7 @@
Margin="4,0,0,0"
HorizontalAlignment="Stretch"
Appearance="{TemplateBinding ButtonRightAppearance}"
Icon="{TemplateBinding ButtonRightIcon}"
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
CommandParameter="right"
Content="{TemplateBinding ButtonRightName}"
Expand Down