Skip to main content

Microsoft Silverlight

Answered Question Scale a canvas including child rectangles and paths? With Viewbox?RSS Feed

(0)

Alex Crieg
Alex Crieg

Member

Member

61 points

35 Posts

Scale a canvas including child rectangles and paths? With Viewbox?

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
silverbyte

Participant

Participant

1338 points

405 Posts

Re: Scale a canvas including child rectangles and paths? With Viewbox?

 just use a ScaleTransform on the parent canvas

I think it will work

also, set height and width on the parent canvas

Please click on 'Mark as answer' near my comment if you feel I answered your question.

Alex Crieg
Alex Crieg

Member

Member

61 points

35 Posts

Re: Scale a canvas including child rectangles and paths? With Viewbox?

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?

Thanks,
Alex

Mog Liang - MSFT
Mog Lian...

All-Star

All-Star

15854 points

1,541 Posts

Answered Question

Re: Scale a canvas including child rectangles and paths? With Viewbox?

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.

Mog Liang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities