You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 30, 2024. It is now read-only.
An event in C# is a way for a class to provide notifications to clients of that class when some interesting thing happens to an object. The most familiar use for events is in graphical user interfaces; typically, the classes that represent controls in the interface have events that are notified when the user does something to the control (for example, click a button).
NativeUI has 9 events in total: 6 for UIMenu, 1 for UIMenuItem, 1 for UIMenuListItem and 1 for UIMenuCheckboxItem.
Events basics
There are two ways to declare an event in C#. One is using a handler method and another one is using lambda expressions.
// First method.
myMenu.OnItemSelect += ItemSelectEventHandler;
public void ItemSelectEventHandler(UIMenu sender, UIMenuItem selectedItem, int index)
{
// Your logic goes here
}
And the second one is
// Second method.
myMenu.OnItemSelect += (sender, selectedItem, index) =>
{
// Your logic goes here
}
UIMenu Events
OnIndexChange (UIMenu sender, int newindex)
OnItemSelect (UIMenu sender, UIMenuItem selectedItem, int index)
OnListChange (UIMenu sender, UIMenuListItem list, int newindex)