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.
- C#
- VB.NET
public class ChatToolbarItemClickEventArgs : ChatCancelableEventArgs
Public Class ChatToolbarItemClickEventArgs
Inherits ChatCancelableEventArgs
Constructors
ChatToolbarItemClickEventArgs(item, message, dataIndex, cancel, name, data)
Initializes a new instance of the ChatToolbarItemClickEventArgs class.
| Name | Type | Description |
|---|---|---|
| item | ToolbarItem | The toolbar item that was clicked. |
| message | ChatMessage | The message that owns the toolbar, or null for the header toolbar. |
| dataIndex | Int32 | The index reported by the browser, or -1 when it is not available. |
| cancel | Boolean | The initial value of Cancel. |
| name | String | The name of the client event. |
| data | Object | The 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
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.
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;
}
};
Message
ChatMessage: Gets the message whose toolbar was clicked.
The value is null when the event is fired for the header toolbar.