Files
Shrlalgo.RvKits/WPFluent/Controls/CardControl/CardControl.cs
2025-04-24 20:56:44 +08:00

67 lines
2.2 KiB
C#

using System.Windows.Automation.Peers;
namespace WPFluent.Controls;
/// <summary>
/// Inherited from the <see cref="System.Windows.Controls.Primitives.ButtonBase"/> control which displays an additional
/// control on the right side of the card.
/// </summary>
public class CardControl : System.Windows.Controls.Primitives.ButtonBase, IIconControl
{
/// <summary>
/// Identifies the <see cref="CornerRadius"/> dependency property.
/// </summary>
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(
nameof(CornerRadius),
typeof(CornerRadius),
typeof(CardControl),
new PropertyMetadata(new CornerRadius(0)));
/// <summary>
/// Identifies the <see cref="Header"/> dependency property.
/// </summary>
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
nameof(Header),
typeof(object),
typeof(CardControl),
new PropertyMetadata(null));
/// <summary>
/// Identifies the <see cref="Icon"/> dependency property.
/// </summary>
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
nameof(Icon),
typeof(IconElement),
typeof(CardControl),
new PropertyMetadata(null));
protected override AutomationPeer OnCreateAutomationPeer() { return new CardControlAutomationPeer(this); }
/// <summary>
/// Gets or sets the corner radius of the control.
/// </summary>
[Bindable(true)]
[Category("Appearance")]
public CornerRadius CornerRadius
{
get => (CornerRadius)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
/// <summary>
/// Gets or sets header which is used for each item in the control.
/// </summary>
[Bindable(true)]
public object Header { get => GetValue(HeaderProperty); set => SetValue(HeaderProperty, value); }
/// <summary>
/// Gets or sets displayed <see cref="IconElement"/>.
/// </summary>
[Bindable(true)]
[Category("Appearance")]
public IconElement? Icon { get => (IconElement?)GetValue(IconProperty); set => SetValue(IconProperty, value); }
}