In This Article

Card Class

A container to group related information for a single subject.

[TemplatePart(Name = "PART_ContentPresenter", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "PART_CoverPresenter", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "PART_FooterPresenter", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "PART_HeaderPresenter", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "PART_ThumbnailPresenter", Type = typeof(ContentPresenter))]
[TemplateVisualState(Name = "NormalAnimation", GroupName = "ResponsiveStates")]
[TemplateVisualState(Name = "PressedAnimation", GroupName = "ResponsiveStates")]
[TemplateVisualState(Name = "RaisedAnimation", GroupName = "ResponsiveStates")]
[TemplateVisualState(Name = "NormalNoAnimation", GroupName = "ResponsiveStates")]
[TemplateVisualState(Name = "PressedNoAnimation", GroupName = "ResponsiveStates")]
[TemplateVisualState(Name = "RaisedNoAnimation", GroupName = "ResponsiveStates")]
public class Card : Button
Inheritance:
object Visual UIElement FrameworkElement Control ContentControl ButtonBase Button object

Constructors

Card()

Initializes an instance of the class.

public Card()

Properties

Badge

A Badge control to adorn the card.

public Badge? Badge { get; set; }

Property Value

Badge

See Also

BadgeHorizontalAlignment

The horizontal alignment of the Badge adornment.

public AdornmentHorizontalAlignment BadgeHorizontalAlignment { get; set; }

Property Value

AdornmentHorizontalAlignment:

The default value is CenterOnTargetRightEdge.

See Also

BadgeHorizontalOffset

The horizontal offset of the Badge adornment.

public double BadgeHorizontalOffset { get; set; }

Property Value

double

See Also

BadgeVerticalAlignment

The vertical alignment of the Badge adornment.

public AdornmentVerticalAlignment BadgeVerticalAlignment { get; set; }

Property Value

AdornmentVerticalAlignment:

The default value is CenterOnTargetTopEdge.

See Also

BadgeVerticalOffset

The vertical offset of the Badge adornment.

public double BadgeVerticalOffset { get; set; }

Property Value

double

See Also

CornerRadius

The CornerRadius applied to the control.

public CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius

Cover

The content for the cover.

public object? Cover { get; set; }

Property Value

object

CoverDock

The dock location for the cover.

public Dock CoverDock { get; set; }

Property Value

Dock:

The default value is Dock.Top.

CoverTemplate

The template used to display the Cover.

public DataTemplate? CoverTemplate { get; set; }

Property Value

DataTemplate

CoverTemplateSelector

The DataTemplateSelector to use for the Cover.

public DataTemplateSelector CoverTemplateSelector { get; set; }

Property Value

DataTemplateSelector

Description

The description associated with the card which, by default, may be used to populate the header.

public string? Description { get; set; }

Property Value

string

DescriptionStyle

The Style applied to the description.

public Style? DescriptionStyle { get; set; }

Property Value

Style

The content for the footer.

public object? Footer { get; set; }

Property Value

object

FooterBackground

The brush used for the background of the footer.

public Brush? FooterBackground { get; set; }

Property Value

Brush

FooterBorderBrush

The brush used for the border of the footer.

public Brush? FooterBorderBrush { get; set; }

Property Value

Brush

FooterBorderThickness

The thickness of the footer border.

public Thickness FooterBorderThickness { get; set; }

Property Value

Thickness

FooterForeground

The brush used for the foreground of the footer.

public Brush? FooterForeground { get; set; }

Property Value

Brush

FooterTemplate

The template used to display the Footer.

public DataTemplate? FooterTemplate { get; set; }

Property Value

DataTemplate

FooterTemplateSelector

The DataTemplateSelector to use for the Footer.

public DataTemplateSelector? FooterTemplateSelector { get; set; }

Property Value

DataTemplateSelector

HasFooterSeparation

Indicates whether there is separation between the footer content area and the content area above it.

public bool HasFooterSeparation { get; }

Property Value

bool

HasHeaderContent

Indicates whether Header has a non-null value.

public bool HasHeaderContent { get; }

Property Value

bool

HasHeaderSeparation

Indicates whether there is separation between the header content area and the content area below it.

public bool HasHeaderSeparation { get; }

Property Value

bool

Header

The content for the header.

public object? Header { get; set; }

Property Value

object

HeaderBackground

The brush used for the background of the header.

public Brush? HeaderBackground { get; set; }

Property Value

Brush

HeaderBorderBrush

The brush used for the border of the header.

public Brush? HeaderBorderBrush { get; set; }

Property Value

Brush

HeaderBorderThickness

The thickness of the header border.

public Thickness HeaderBorderThickness { get; set; }

Property Value

Thickness

HeaderForeground

The brush used for the foreground of the header.

public Brush? HeaderForeground { get; set; }

Property Value

Brush

HeaderTemplate

The template used to display the Header.

public DataTemplate? HeaderTemplate { get; set; }

Property Value

DataTemplate

HeaderTemplateSelector

The DataTemplateSelector to use for the Header.

public DataTemplateSelector? HeaderTemplateSelector { get; set; }

Property Value

DataTemplateSelector

IsAnimationEnabled

Indicates whether animations are enabled for an element, when supported.

public bool IsAnimationEnabled { get; set; }

Property Value

bool:

The default value is true.

IsClickEnabled

Indicates if clicking the card is enabled.

public bool IsClickEnabled { get; set; }

Property Value

bool

Remarks

This property is always true when a Command is assigned to the card. The default value is false.

IsCoverVisible

Indicates if the cover is visible.

public bool? IsCoverVisible { get; set; }

Property Value

bool?:

true to force the cover to be visible, false to force the cover to be hidden, or null to show the cover only when cover content is available. The default value is null.

IsFooterVisible

Indicates if the footer is visible.

public bool? IsFooterVisible { get; set; }

Property Value

bool?:

true to force the footer to be visible, false to force the footer to be hidden, or null to show the footer only when footer content is available. The default value is null.

IsHeaderVisible

Indicates if the header is visible.

public bool? IsHeaderVisible { get; set; }

Property Value

bool?:

true to force the header to be visible, false to force the header to be hidden, or null to show the header only when header content is available. The default value is null.

IsResponsiveToPointerOver

Indicates if the control should respond to pointer over events.

public bool IsResponsiveToPointerOver { get; set; }

Property Value

bool:

true to respond to pointer over events; otherwise, false. The default value is false, although the control template may assign a default value.

Remarks

The response to the event, if any, is dictated by the control template.

IsResponsiveToPointerPressed

Indicates if the control should respond to pointer pressed events.

public bool IsResponsiveToPointerPressed { get; set; }

Property Value

bool:

true to respond to pointer pressed events; otherwise, false. The default value is false, although the control template may assign a default value.

Remarks

The response to the event, if any, is dictated by the control template.

IsShadowEnabled

Indicates whether the shadow can be rendered by the chrome.

public bool IsShadowEnabled { get; set; }

Property Value

bool:

true if the shadow can be rendered by the chrome; otherwise, false. The default value is true.

Remarks

Set this property to false to prevent the shadow from rendering.

IsThumbnailVisible

Indicates if the thumbnail is visible.

public bool? IsThumbnailVisible { get; set; }

Property Value

bool?:

true to force the thumbnail to be visible, false to force the thumbnail to be hidden, or null to show the thumbnail only when thumbnail content is available. The default value is null.

ShadowOpacity

The opacity of the shadow.

public double ShadowOpacity { get; set; }

Property Value

double:

The opacity of the shadow, a value from 0 to 1. The default value is 0.3.

Thumbnail

The content for the thumbnail.

public object? Thumbnail { get; set; }

Property Value

object

ThumbnailStyle

The Style applied to the thumbnail.

public Style? ThumbnailStyle { get; set; }

Property Value

Style

ThumbnailTemplate

The template used to display the Thumbnail.

public DataTemplate? ThumbnailTemplate { get; set; }

Property Value

DataTemplate

ThumbnailTemplateSelector

The DataTemplateSelector to use for the Thumbnail.

public DataTemplateSelector? ThumbnailTemplateSelector { get; set; }

Property Value

DataTemplateSelector

Title

The title associated with the card which, by default, may be used to populate the header.

public string? Title { get; set; }

Property Value

string

TitleStyle

The Style applied to the title.

public Style? TitleStyle { get; set; }

Property Value

Style

Methods

DoesPropertyAffectVisualState(DependencyProperty)

Tests if a change in the value for a given property might affects visual state.

protected virtual bool DoesPropertyAffectVisualState(DependencyProperty property)
Parameter Type Description
property DependencyProperty

The property to examine.

Returns

bool:

true if a property might affect visual state; otherwise, false.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnClick()

Called when a Button is clicked.

protected override void OnClick()

OnCreateAutomationPeer()

Creates an appropriate ButtonAutomationPeer for this control as part of the WPF infrastructure.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

A ButtonAutomationPeer for this control.

OnPropertyChanged(DependencyPropertyChangedEventArgs?)

Invoked whenever the effective value of any dependency property on this FrameworkElement has been updated. The specific dependency property that changed is reported in the arguments parameter. Overrides System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs).

protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs? e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

The event data that describes the property that changed, as well as old and new values.

ResolveVisualState()

Returns the name of the current visual state.

protected virtual string ResolveVisualState()

Returns

string

ToString()

Returns the string representation of this object.

public override string ToString()

Returns

string:

The string representation of this object.

Fields

BadgeHorizontalAlignmentProperty

Defines the BadgeHorizontalAlignment property.

public static readonly DependencyProperty BadgeHorizontalAlignmentProperty

BadgeHorizontalOffsetProperty

Defines the BadgeHorizontalOffset property.

public static readonly DependencyProperty BadgeHorizontalOffsetProperty

BadgeProperty

Defines the Badge property.

public static readonly DependencyProperty BadgeProperty

BadgeVerticalAlignmentProperty

Defines the BadgeVerticalAlignment property.

public static readonly DependencyProperty BadgeVerticalAlignmentProperty

BadgeVerticalOffsetProperty

Defines the BadgeVerticalOffset property.

public static readonly DependencyProperty BadgeVerticalOffsetProperty

CornerRadiusProperty

Defines the CornerRadius property.

public static readonly DependencyProperty CornerRadiusProperty

CoverDockProperty

Defines the CoverDock property.

public static readonly DependencyProperty CoverDockProperty

CoverProperty

Defines the Cover property.

public static readonly DependencyProperty CoverProperty

CoverTemplateProperty

Defines the CoverTemplate property.

public static readonly DependencyProperty CoverTemplateProperty

CoverTemplateSelectorProperty

Defines the CoverTemplateSelector property.

public static readonly DependencyProperty CoverTemplateSelectorProperty

DescriptionProperty

Defines the Description property.

public static readonly DependencyProperty DescriptionProperty

DescriptionStyleProperty

Defines the DescriptionStyle property.

public static readonly DependencyProperty DescriptionStyleProperty

FooterBackgroundProperty

Defines the FooterBackground property.

public static readonly DependencyProperty FooterBackgroundProperty

FooterBorderBrushProperty

Defines the FooterBorderBrush property.

public static readonly DependencyProperty FooterBorderBrushProperty

FooterBorderThicknessProperty

Defines the FooterBorderThickness property.

public static readonly DependencyProperty FooterBorderThicknessProperty

FooterForegroundProperty

Defines the FooterForeground property.

public static readonly DependencyProperty FooterForegroundProperty

FooterProperty

Defines the Footer property.

public static readonly DependencyProperty FooterProperty

FooterTemplateProperty

Defines the FooterTemplate property.

public static readonly DependencyProperty FooterTemplateProperty

FooterTemplateSelectorProperty

Defines the FooterTemplateSelector property.

public static readonly DependencyProperty FooterTemplateSelectorProperty

HasFooterSeparationProperty

Defines the HasFooterSeparation property.

public static readonly DependencyProperty HasFooterSeparationProperty

HasHeaderContentProperty

Defines the HasHeaderContent property.

public static readonly DependencyProperty HasHeaderContentProperty

HasHeaderSeparationProperty

Defines the HasHeaderSeparation property.

public static readonly DependencyProperty HasHeaderSeparationProperty

HeaderBackgroundProperty

Defines the HeaderBackground property.

public static readonly DependencyProperty HeaderBackgroundProperty

HeaderBorderBrushProperty

Defines the HeaderBorderBrush property.

public static readonly DependencyProperty HeaderBorderBrushProperty

HeaderBorderThicknessProperty

Defines the HeaderBorderThickness property.

public static readonly DependencyProperty HeaderBorderThicknessProperty

HeaderForegroundProperty

Defines the HeaderForeground property.

public static readonly DependencyProperty HeaderForegroundProperty

HeaderProperty

Defines the Header property.

public static readonly DependencyProperty HeaderProperty

HeaderTemplateProperty

Defines the HeaderTemplate property.

public static readonly DependencyProperty HeaderTemplateProperty

HeaderTemplateSelectorProperty

Defines the HeaderTemplateSelector property.

public static readonly DependencyProperty HeaderTemplateSelectorProperty

IsAnimationEnabledProperty

Defines the IsAnimationEnabled property.

public static readonly DependencyProperty IsAnimationEnabledProperty

IsClickEnabledProperty

Defines the IsClickEnabled property.

public static readonly DependencyProperty IsClickEnabledProperty

IsCoverVisibleProperty

Defines the IsCoverVisible property.

public static readonly DependencyProperty IsCoverVisibleProperty

IsFooterVisibleProperty

Defines the IsFooterVisible property.

public static readonly DependencyProperty IsFooterVisibleProperty

IsHeaderVisibleProperty

Defines the IsHeaderVisible property.

public static readonly DependencyProperty IsHeaderVisibleProperty

IsResponsiveToPointerOverProperty

Defines the IsResponsiveToPointerOver property.

public static readonly DependencyProperty IsResponsiveToPointerOverProperty

IsResponsiveToPointerPressedProperty

Defines the IsResponsiveToPointerPressed property.

public static readonly DependencyProperty IsResponsiveToPointerPressedProperty

IsShadowEnabledProperty

Defines the IsShadowEnabled property.

public static readonly DependencyProperty IsShadowEnabledProperty

IsThumbnailVisibleProperty

Defines the IsThumbnailVisible property.

public static readonly DependencyProperty IsThumbnailVisibleProperty

ShadowOpacityProperty

Defines the ShadowOpacity property.

public static readonly DependencyProperty ShadowOpacityProperty

ThumbnailProperty

Defines the Thumbnail property.

public static readonly DependencyProperty ThumbnailProperty

ThumbnailStyleProperty

Defines the ThumbnailStyle property.

public static readonly DependencyProperty ThumbnailStyleProperty

ThumbnailTemplateProperty

Defines the ThumbnailTemplate property.

public static readonly DependencyProperty ThumbnailTemplateProperty

ThumbnailTemplateSelectorProperty

Defines the ThumbnailTemplateSelector property.

public static readonly DependencyProperty ThumbnailTemplateSelectorProperty

TitleProperty

Defines the Title property.

public static readonly DependencyProperty TitleProperty

TitleStyleProperty

Defines the TitleStyle property.

public static readonly DependencyProperty TitleStyleProperty

Extension Methods