Reputation: 1375
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
Upvotes: 0
Views: 1091
Reputation: 29196
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
Upvotes: 1
Reputation: 1
Use code behind to add the button during runtime. Anything you do in XAML can be done in code behind.
Upvotes: 0