Avatar
Namespace: Wisej.Web
Assembly: Wisej.Framework (4.2.0.0)
Displays an image or generated initials, a presence indicator, and optional inline labels.
- C#
- VB.NET
public class Avatar : Control
Public Class Avatar
Inherits Control
AvatarSize is the portrait diameter in pixels; the inherited Size controls the entire surface including labels. Text uses the first grapheme of the first and last name. Empty names display a neutral placeholder. Failed images fall back to initials. Image instances remain owned by the caller.
Example:
var avatar = new Avatar {
Text = "Saoirse Kovač", Label = "Saoirse Kovač", SubLabel = "Finance",
Presence = AvatarPresence.Online, AvatarSize = (int)AvatarSizePreset.M,
Size = new Size(280, 48)
};
avatar.Click += (s, e) => MessageBox.Show(avatar.Text);
Controls.Add(avatar);
Constructors
Avatar()
Creates a focusable portrait with a 40 pixel diameter.
Properties
AutoColor
Boolean: Gets or sets whether a deterministic color is chosen from Text. (Default: True)
AvatarSize
Int32: Gets or sets the portrait diameter, from 16 to 256 pixels. The default is 40. (Default: 40)
Use AvatarSizePreset values cast to int for standard sizes. This does not change the inherited control Size.
AwayText
String: Gets or sets the localized override for the "away" text. (Default: null)
The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation.
BusyText
String: Gets or sets the localized override for the "busy" text. (Default: null)
The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation.
DefaultSize
Size: Gets the default 40 by 40 control size.
Image
Image: Gets or sets the image displayed in preference to ImageSource. The caller retains ownership. (Default: null)
ImageSource
String: Gets or sets a Wisej image source, URL, or theme image name. (Default: "")
Label
String: Gets or sets the primary label displayed beside the portrait. (Default: "")
OfflineText
String: Gets or sets the localized override for the "offline" text. (Default: null)
The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation.
OnlineText
String: Gets or sets the localized override for the "online" text. (Default: null)
The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation.
Presence
AvatarPresence: Gets or sets the presence indicator. (Default: None)
Shape
AvatarShape: Gets or sets the outline shape. (Default: Circle)
SubLabel
String: Gets or sets the secondary label displayed beside the portrait. (Default: "")
Text
String: Gets or sets the name used to derive up to two initials. (Default: "")
Methods
OnWebEvent(e)
Dispatches client activation while suppressing duplicate native taps.
| Parameter | Type | Description |
|---|---|---|
| e | WisejEventArgs | Client event. |
OnWebRender(config)
Serializes the portrait and wires activation independently of event subscriptions.
| Parameter | Type | Description |
|---|---|---|
| config | Object | Client configuration. |
Implements
| Name | Description |
|---|---|
| IUserData | Provides access to the UserData and Tag properties associated to the component implementing this interface. |
| IBindableComponent | Bindable components implement this interface. |
| IDropTarget | Controls that support drag & drop operations implement this interface. |
| IWisejComponent | All wisej components implement this interface. |
| IWisejControl | All wisej controls derived from the Control class must implement this interface. |
| IWisejSerializable | Allows an object to serialize itself. |