views:

221

answers:

2

Hi All,

How do I add button dynamically using C# on ArcGIS?

I can create that using XAML, but I can't write that on C#, I checked on the website on ArcGIS, they allowed to add graphics dynamically, but there is no sample to show how to add controls such as button dynamically.

Can anyone provide me some sample code?

Thanks

A: 

Use code behind to add the button during runtime. Anything you do in XAML can be done in code behind.

Klaus
A: 

Add an ElementLayer to your map (ether in xaml or in code ), then add your button to the element layer.

MyMap.Layers.Add( new ElementLayer() { id="myElementLayer" } )

// create your button.....

MyMap.Layers[ "myElementLayer" ].Add( myButton );

there is an online sample here

Muad'Dib