PlayKid
PlayKid

Reputation: 1375

How do I add button dynamically on ArcGIS Silverlight API?

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

Answers (2)

Muad'Dib
Muad'Dib

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

Klaus
Klaus

Reputation: 1

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

Upvotes: 0

Related Questions