更新整理
This commit is contained in:
66
WPFluent/Controls/CardControl/CardControl.cs
Normal file
66
WPFluent/Controls/CardControl/CardControl.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
|
||||
|
||||
|
||||
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); }
|
||||
}
|
||||
Reference in New Issue
Block a user