Custom Tool - Popup Toolbar - Retrieving Popup's Graphic

816
2
Jump to solution
03-29-2012 11:02 AM
MarcusGwillim
New Contributor
Since it is now possible to have tools in the popup window (PopupToolbarContainer section in Tools.xml), I was wondering what is the best method to retrieve the graphic associated with the currently shown popup window. I am looking to retrieve information from the attribute dictionary of the graphic when the tool is executed.
0 Kudos
1 Solution

Accepted Solutions
RichZwaap
Occasional Contributor III
Hi Marcus:

With tools on the pop-up's toolbar, the parameter passed to the Execute and CanExecute methods is an OnClickPopUpInfo object.  So in the Execute method, you can get the feature currently shown in the pop-up like so:

public void Execute(object parameter) {     // Get feature currently shown in pop-up     OnClickPopupInfo popupInfo = parameter as OnClickPopupInfo;     Graphic currentFeature = popupInfo.PopupItem.Graphic;                        }


If you need to show the names of fields in the UI, you can get the configured field names and visibility via OnClickPopUpInfo.PopupItem.FieldInfos.

A sample that calculates service areas for the feature shown in the pop-up should be available on the code gallery within the next couple days.

Hope this helps.

View solution in original post

0 Kudos
2 Replies
RichZwaap
Occasional Contributor III
Hi Marcus:

With tools on the pop-up's toolbar, the parameter passed to the Execute and CanExecute methods is an OnClickPopUpInfo object.  So in the Execute method, you can get the feature currently shown in the pop-up like so:

public void Execute(object parameter) {     // Get feature currently shown in pop-up     OnClickPopupInfo popupInfo = parameter as OnClickPopupInfo;     Graphic currentFeature = popupInfo.PopupItem.Graphic;                        }


If you need to show the names of fields in the UI, you can get the configured field names and visibility via OnClickPopUpInfo.PopupItem.FieldInfos.

A sample that calculates service areas for the feature shown in the pop-up should be available on the code gallery within the next couple days.

Hope this helps.
0 Kudos
MarcusGwillim
New Contributor
Thank you! That worked perfectly.
I can't believe I didn't think of looking at the command parameter >.<
0 Kudos