Select to view content in your preferred language

How to obtain button id on click event?

1098
2
10-04-2018 07:25 AM
RomanTrojan
Emerging Contributor

I would like to retrieve button id of Config.daml from c# OnClick event without fixed coding:

...

<controls>

   <button id="ButtonID_TS1" className="ModuleID_TestAddIn:OnCustomButtonClick_StateID_1"

...

internal static void OnCustomButtonClick_StateID_1()
{

string ButtonID = ?   // how to obtain button id? --> "ButtonID_TS1";

...

I am studying arcgis-pro-sdk/wiki/ProConcepts-Framework with arcgis-pro-sdk-community-samples but cannot find appropriate method.

Having ButtonID I am able to get another button parameters using ArcGIS.Desktop.Framework - FrameworkApplication.GetPlugInWrapper(ButtonID) or any custom parameters applying <categories> with <content> using Categories.GetComponentElements and component.ReadAttribute functions.

0 Kudos
2 Replies
UmaHarano
Esri Regular Contributor

Hi Roman

You can get the button's ID directly like this:

internal class Button1 : Button
    {
        protected override void OnClick()
        {
            var buttonID = this.ID;
        }
    }

Thanks

Uma

RomanTrojan
Emerging Contributor

Thank you, Ulma

Declaring my first button I have skipped to the issue with delegate command.
Stepping back to the Button class this.ID works fine.

But calling delegated void procedure on Module class there is no "this" constructor regarding button?

0 Kudos