Get the value "Text" from "System.EventArgs objArgs"

As you can see in this screenshot in "objArgs" there is a property "Text". How can I achieve this property?

enter image description here

+4
source share
1 answer

You need to pass arguments ToolBarItemEventArgs, after which you can access ToolBarButton, this applies to:

var toolBarArgs = (ToolBarItemEventArgs) objArgs;
switch (toolBarArgs.ToolBarButton.Text)
{
    ...
}

However, I would suggest not including the text. Instead, ideally configure a different event handler for each of your buttons. If you really cannot do this, you can use:

var toolBarArgs = (ToolBarItemEventArgs) objArgs;
var button = toolBarArgs.ToolBarButton;
if (button == saveButton)
{
    ...
}

Name, Text - , Name , Text .

+9

Source: https://habr.com/ru/post/1625097/


All Articles