using System.Windows.Controls;
// ReSharper disable once CheckNamespace
namespace WPFluent.Controls;
///
/// Inherited from the , adding .
///
///
/// <ui:Button Appearance="Primary" Content="WPF UI button with font icon" Icon="{ui:SymbolIcon
/// Symbol=Fluent24}" /> <ui:Button Appearance="Primary" Content="WPF UI button with font
/// icon" Icon="{ui:FontIcon '🌈'}" />
///
///
/// The class inherits from the base class.
///
public class Button : System.Windows.Controls.Button, IAppearanceControl, IIconControl
{
///
/// Identifies the dependency property.
///
public static readonly DependencyProperty AppearanceProperty = DependencyProperty.Register(
nameof(Appearance),
typeof(ControlAppearance),
typeof(Button),
new PropertyMetadata(ControlAppearance.Primary));
///
/// Identifies the dependency property.
///
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(
nameof(CornerRadius),
typeof(CornerRadius),
typeof(Button),
new FrameworkPropertyMetadata(
default(CornerRadius),
FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender));
///
/// Identifies the dependency property.
///
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
nameof(Icon),
typeof(IconElement),
typeof(Button),
new PropertyMetadata(null, null, IconElement.Coerce));
///
/// Identifies the dependency property.
///
public static readonly DependencyProperty MouseOverBackgroundProperty = DependencyProperty.Register(
nameof(MouseOverBackground),
typeof(Brush),
typeof(Button),
new PropertyMetadata(Border.BackgroundProperty.DefaultMetadata.DefaultValue));
///
/// Identifies the dependency property.
///
public static readonly DependencyProperty MouseOverBorderBrushProperty = DependencyProperty.Register(
nameof(MouseOverBorderBrush),
typeof(Brush),
typeof(Button),
new PropertyMetadata(Border.BorderBrushProperty.DefaultMetadata.DefaultValue));
///
/// Identifies the dependency property.
///
public static readonly DependencyProperty PressedBackgroundProperty = DependencyProperty.Register(
nameof(PressedBackground),
typeof(Brush),
typeof(Button),
new PropertyMetadata(Border.BackgroundProperty.DefaultMetadata.DefaultValue));
///
/// Identifies the dependency property.
///
public static readonly DependencyProperty PressedBorderBrushProperty = DependencyProperty.Register(
nameof(PressedBorderBrush),
typeof(Brush),
typeof(Button),
new PropertyMetadata(Border.BorderBrushProperty.DefaultMetadata.DefaultValue));
///
/// Identifies the dependency property.
///
public static readonly DependencyProperty PressedForegroundProperty = DependencyProperty.Register(
nameof(PressedForeground),
typeof(Brush),
typeof(Button),
new FrameworkPropertyMetadata(SystemColors.ControlTextBrush, FrameworkPropertyMetadataOptions.Inherits));
///
[Bindable(true)]
[Category("Appearance")]
public ControlAppearance Appearance
{
get => (ControlAppearance)GetValue(AppearanceProperty);
set => SetValue(AppearanceProperty, value);
}
///
/// Gets or sets a value that represents the degree to which the corners of a are rounded.
///
public CornerRadius CornerRadius
{
get => (CornerRadius)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
///
/// Gets or sets displayed .
///
[Bindable(true)]
[Category("Appearance")]
public IconElement? Icon { get => (IconElement)GetValue(IconProperty); set => SetValue(IconProperty, value); }
///
/// Gets or sets background .
///
[Bindable(true)]
[Category("Appearance")]
public Brush MouseOverBackground
{
get => (Brush)GetValue(MouseOverBackgroundProperty);
set => SetValue(MouseOverBackgroundProperty, value);
}
///
/// Gets or sets border when the user mouses over the button.
///
[Bindable(true)]
[Category("Appearance")]
public Brush MouseOverBorderBrush
{
get => (Brush)GetValue(MouseOverBorderBrushProperty);
set => SetValue(MouseOverBorderBrushProperty, value);
}
///
/// Gets or sets background when the user clicks the button.
///
[Bindable(true)]
[Category("Appearance")]
public Brush PressedBackground
{
get => (Brush)GetValue(PressedBackgroundProperty);
set => SetValue(PressedBackgroundProperty, value);
}
///
/// Gets or sets border when the user clicks the button.
///
[Bindable(true)]
[Category("Appearance")]
public Brush PressedBorderBrush
{
get => (Brush)GetValue(PressedBorderBrushProperty);
set => SetValue(PressedBorderBrushProperty, value);
}
///
/// Gets or sets the foreground when the user clicks the button.
///
[Bindable(true)]
[Category("Appearance")]
public Brush PressedForeground
{
get => (Brush)GetValue(PressedForegroundProperty);
set => SetValue(PressedForegroundProperty, value);
}
}