In This Article

Avatar Class

Renders textual or visual content to represent a user's identity.

public class Avatar : Button
Inheritance:
object Visual UIElement FrameworkElement Control ContentControl ButtonBase Button object

Constructors

Avatar()

Initializes an instance of the class.

public Avatar()

Properties

CornerRadius

The CornerRadius for the control's border.

public CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius

Description

The string description that can derive initials for the Content property, and is also used as tooltip content by default.

public string? Description { get; set; }

Property Value

string

Remarks

When the Content property is null, initials will be derived from the description and coerced into the Content property result.

EmptyContentTemplate

The DataTemplate to use when there is no content.

public DataTemplate? EmptyContentTemplate { get; set; }

Property Value

DataTemplate

Remarks

The default value renders a generic person glyph.

IsEmpty

Indicates whether the avatar content is empty.

public bool IsEmpty { get; }

Property Value

bool

TextAppearanceKind

An AvatarTextAppearanceKind value indicating how the control's background and foreground appearance can be dynamically changed based on any text assigned to the Content property.

public AvatarTextAppearanceKind TextAppearanceKind { get; set; }

Property Value

AvatarTextAppearanceKind:

The default value is AutomaticSolid.

Methods

ArrangeOverride(Size?)

Called to arrange and size the content of a Control object.

protected override Size? ArrangeOverride(Size? arrangeBounds)
Parameter Type Description
arrangeBounds Size

The computed size that is used to arrange the content.

Returns

Size:

The size of the control.

MeasureOverride(Size?)

Called to remeasure a control.

protected override Size? MeasureOverride(Size? constraint)
Parameter Type Description
constraint Size

The maximum size that the method can return.

Returns

Size:

The size of the control, up to the maximum specified by constraint.

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.

ToString()

Returns the string representation of this object.

public override string ToString()

Returns

string:

The string representation of this object.

Fields

CornerRadiusProperty

Defines the CornerRadius property.

public static readonly DependencyProperty CornerRadiusProperty

DescriptionProperty

Defines the Description property.

public static readonly DependencyProperty DescriptionProperty

EmptyContentTemplateProperty

Defines the EmptyContentTemplate property.

public static readonly DependencyProperty EmptyContentTemplateProperty

IsEmptyProperty

Defines the IsEmpty property.

public static readonly DependencyProperty IsEmptyProperty

TextAppearanceKindProperty

Defines the TextAppearanceKind property.

public static readonly DependencyProperty TextAppearanceKindProperty

Extension Methods