Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Scale a canvas including child rectangles and paths? With Viewbox?
3 replies. Latest Post by Mog Liang - MSFT on June 22, 2009.
(0)
Alex Crieg
Member
61 points
35 Posts
06-16-2009 1:59 PM |
Hi,
I'd like to make a kind of "map" containing child shapes like rectangles and paths(representing countries in Europe for example) inside a Canvas. As the browser window is made bigger and smaller I want all the child shapes in the "map" to scale proportionally. Can I do this with a Viewbox from the SL2 Toolkit? Is there a better way?
Thanks,Alex
silverbyte
Participant
1338 points
405 Posts
06-16-2009 2:26 PM |
just use a ScaleTransform on the parent canvas
I think it will work
also, set height and width on the parent canvas
06-16-2009 2:51 PM |
Hi silverbyte,
Thanks for the suggestion. I can try that approach, I had seen it mentioned before. Apparently that is still considered the "state of the art" / best practice?
I was hoping it would be as simple as just wrapping my canvas with a Viewbox. I tried the SL2 Toolkit Viewbox but got odd results. I hoped maybe I was just using it incorrectly, but maybe there is no way to do this with a Viewbox?
Mog Lian...
All-Star
15854 points
1,541 Posts
06-22-2009 1:39 AM |
hi,
Set silverlight plugin's scalemode=stretch or zoom. plugin will zoom the application's size according to the plugin's available size. precondition is UserControl's Width/Height must be set with fixed value.