Class ChatConversationListItem
One conversation in a chat sidebar's history list.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class ChatConversationListItem : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
The row is two targets, not one. The body selects the conversation; the trailing star toggles its favourite state without selecting it. The star only appears on hover, on keyboard focus, or when the conversation is already a favourite, so a long list stays quiet until you reach for it.
The row does not decide what "active" means: isActive is set by the list that owns the selection.
Examples
A favourited row in a history list.
var item = new ChatConversationListItem
{
title = "Megaman clone",
subtitle = "2 hours ago",
isFavorite = true
};
item.clicked += () => OpenConversation(id);
item.favoriteToggled += () => ToggleFavorite(id);
parentElement.Add(item);
In UXML.
<appui:ChatConversationListItem title="Megaman clone" subtitle="2 hours ago" is-active="true" />
Constructors
ChatConversationListItem()
Default constructor.
Declaration
public ChatConversationListItem()
Fields
bodyUssClassName
The styling class of the selectable body.
Declaration
public const string bodyUssClassName = "appui-chat-conversation-list-item__body"
Field Value
| Type | Description |
|---|---|
| string |
favoriteButtonUssClassName
The styling class of the favourite toggle.
Declaration
public const string favoriteButtonUssClassName = "appui-chat-conversation-list-item__favorite-button"
Field Value
| Type | Description |
|---|---|
| string |
favoriteUssClassName
The styling class applied while the conversation is a favourite.
Declaration
public const string favoriteUssClassName = "appui-chat-conversation-list-item--favorite"
Field Value
| Type | Description |
|---|---|
| string |
subtitleUssClassName
The styling class of the subtitle.
Declaration
public const string subtitleUssClassName = "appui-chat-conversation-list-item__subtitle"
Field Value
| Type | Description |
|---|---|
| string |
titleUssClassName
The styling class of the title.
Declaration
public const string titleUssClassName = "appui-chat-conversation-list-item__title"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The ChatConversationListItem main styling class.
Declaration
public const string ussClassName = "appui-chat-conversation-list-item"
Field Value
| Type | Description |
|---|---|
| string |
Properties
clickable
The body's press handler.
Declaration
public Pressable clickable { get; }
Property Value
| Type | Description |
|---|---|
| Pressable |
favoritable
Whether the favourite toggle is offered at all. True by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool favoritable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
favoriteButton
The trailing favourite toggle.
Declaration
public IconButton favoriteButton { get; }
Property Value
| Type | Description |
|---|---|
| IconButton |
isActive
Whether this is the conversation currently open.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool isActive { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
isFavorite
Whether the conversation is a favourite. A favourite row keeps its star visible.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool isFavorite { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
subtitle
A second line under the title, for instance when the conversation was last touched. Null or empty hides it entirely rather than leaving a gap.
Declaration
[CreateProperty]
[UxmlAttribute]
public string subtitle { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
title
The conversation's title. Also used as the row's tooltip, since a long title truncates.
Declaration
[CreateProperty]
[UxmlAttribute]
public string title { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Events
clicked
Raised when the conversation body is activated.
Declaration
public event Action clicked
Event Type
| Type | Description |
|---|---|
| Action |
favoriteToggled
Raised when the favourite star is activated. The caller owns the resulting state change.
Declaration
public event Action favoriteToggled
Event Type
| Type | Description |
|---|---|
| Action |