Share via


AvatarView Class

Definition

The AvatarView control allows the user to display an avatar or the user's initials if no avatar is available. By binding the Source property the user can assign an image to the AvatarView. Simultaneously binding the Text property will allow the user to also set the initials to be shown if no valid image is provided.

public class AvatarView : Xamarin.CommunityToolkit.UI.Views.Internals.BaseTemplatedView<Xamarin.Forms.Frame>
Inheritance

Constructors

AvatarView()

Fields

AspectProperty

Backing BindableProperty for the Aspect property.

BorderColorProperty

Backing BindableProperty for the BorderColor property.

ColorProperty

Backing BindableProperty for the Color property.

ColorThemeProperty

Backing BindableProperty for the ColorTheme property.

CornerRadiusProperty

Backing BindableProperty for the CornerRadius property.

FontAttributesProperty

Backing BindableProperty for the FontAttributes property.

FontFamilyProperty

Backing BindableProperty for the FontFamily property.

FontSizeProperty

Backing BindableProperty for the FontSize property.

SizeProperty

Backing BindableProperty for the Size property.

SourceProperty

Backing BindableProperty for the Source property.

TextColorProperty

Backing BindableProperty for the TextColor property.

TextProperty

Backing BindableProperty for the Text property.

Properties

Aspect

Setting the Aspect property determines how the avatar image is shown. Depending on the Aspect value it might crop the assigned image. This only applies when Source is set and results in showing an image. This is a bindable property.

BorderColor

Gets or sets the border Color of the image for the AvatarView. This is a bindable property.

Color

Gets or sets the background Color of the for the AvatarView. This only applies when Source is not set or doesn't result in a showing image. This is a bindable property.

ColorTheme

Gets or sets the ColorTheme to be used on the AvatarView. This only applies when the Source is not set or doesn't result in showing an image. This is a bindable property.

Control (Inherited from BaseTemplatedView<TControl>)
CornerRadius

Gets or sets the corner radius of the image for the AvatarView. This is a bindable property.

FontAttributes

Font attributes of the text on the AvatarView. This is a bindable property.

FontFamily

Font of the Text on the AvatarView. This is a bindable property.

FontSize

Font size of the text on the AvatarView. NamedSize values can be used. This is a bindable property.

Size

Gets or sets the size of the image for the AvatarView. This is a bindable property.

Source

Gets or sets the ImageSource that is used to try and show an avatar image. If the image could not be loaded, the Text will be shown. This is a bindable property.

Text

Gets or sets the text for the AvatarView. Which is shown instead of the image when the Source is either not set or doesn't result in showing an image. This is a bindable property.

TextColor

Gets or sets the Color of the Text for the AvatarView. This is a bindable property.

Methods

OnBindingContextChanged()
OnChildAdded(Element) (Inherited from BaseTemplatedView<TControl>)
OnControlInitialized(Frame)
OnControlInitialized(TControl) (Inherited from BaseTemplatedView<TControl>)
OnSizeAllocated(Double, Double)

Applies to