Skip to main content

ChatToolbarItemClickEventArgs

Namespace: Wisej.Web.Ext.Syncfusion2

Assembly: Wisej.Web.Ext.Syncfusion2 (4.1.0.0)

Provides the clicked toolbar item and optional message context for header and message toolbars.

public class ChatToolbarItemClickEventArgs : ChatCancelableEventArgs

Constructors​

Instance member ChatToolbarItemClickEventArgs(item, message, dataIndex, cancel, name, data)​

Initializes a new instance of the ChatToolbarItemClickEventArgs class.

NameTypeDescription
itemToolbarItemThe toolbar item that was clicked.
messageChatMessageThe message that owns the toolbar, or null for the header toolbar.
dataIndexInt32The index reported by the browser, or -1 when it is not available.
cancelBooleanThe initial value of Cancel.
nameStringThe name of the client event.
dataObjectThe raw event data received from the browser, or null.

Example:

The following example, placed in a class derived from Chat, raises HeaderToolbarItemClicked for the first item of the header toolbar.

ToolbarItem item = this.HeaderToolbar.Items[0];
this.OnHeaderToolbarItemClicked(new ChatToolbarItemClickEventArgs(item, null, 0, false, "headerToolbarItemClicked", null));

Properties​

Instance member DataIndex​

Int32: Gets the index reported by the browser for the click, or -1 when it is not available.

When the browser does not send the details of the clicked item, the control uses this index to find the item in the Items or Items assigned to the toolbar.

Instance member Item​

ToolbarItem: Gets the toolbar item that was clicked.

The item is rebuilt from the data sent by the browser and is not the instance assigned to HeaderToolbar or MessageToolbarSettings, unless the browser sends no details and the item is found through DataIndex. Identify it by comparing the fields that were set on the item, such as Text, Tooltip or IconCss. The value can be null when the item cannot be determined.

Example:

The following example identifies the clicked item of the message toolbar by its tooltip.

chat.MessageToolbarItemClicked += (s, e) =>
{
switch (e.Item?.Tooltip)
{
case "Forward":
AlertBox.Show("Forward: " + e.Message?.Text);
break;

case "Copy":
AlertBox.Show("Copy: " + e.Message?.Text);
break;
}
};

Instance member Message​

ChatMessage: Gets the message whose toolbar was clicked.

The value is null when the event is fired for the header toolbar.