Select to view content in your preferred language

Placing Map in a Canvas

1017
5
08-13-2010 02:08 PM
MansourArshon
Emerging Contributor
Hi,

I like to have all my toolbar and boxes on my layout enabled for drag and drop. To do so, I need to place the Map in a Canvas so I can re-position everything to the Canvas.Left and Canvas.Top. Right?
However as soon as I put the Map in a Canvas, the size of map changes to a tiny rectangle. When I don't have the Canvas, the Map takes all the screen. What can I do to have the Map to take all the screen but still be in a Canvas?

Mansour
0 Kudos
5 Replies
MansourArshon
Emerging Contributor
So, I thought I should do this in the code behind however in the code behind the value for the Canvas width is NaN even though the Canvas is filling the screen. It is a bit confusing....hummm
0 Kudos
JenniferNery
Esri Regular Contributor
How about placing the map inside a border with height and width before placing the border inside a canvas?
0 Kudos
MansourArshon
Emerging Contributor
It didn't help;
Here is a bit more info on the problem:
If I put the Map in the root, it will fill the screen; if I put it in a Canvas, it appears in a small rectangle (The Canvas itself fills the screen; I can verify it by setting a background color for Canvas). To resolve this, I wanted to set the Map width and height to the Canvas width and height but the values of Canvas width and height at run time are NaN.
How can I have the Map to fill the screen?

Thanks again,
Mansour
0 Kudos
AliMirzabeigi
Emerging Contributor
Mansour,

Any Silverlight control you add to a Canvas control should have their Width and Height values set in addition to the Canvas.Left and Canvas.Top properties. You can use a Grid control instead and use its Margin property for repositioning your elements.
0 Kudos
MansourArshon
Emerging Contributor
Ali,

Thank you for the helpful tip. I made the drag and drop working with margin instead.

Kind Regards,
Mansour
0 Kudos