views:

669

answers:

2

I am aware of the FontStretch property, but not really sure how to use it.

What I want is to create a window designed with a resolution of say 200x400. Then when the user stretches it to 400x800 (or whatever), I'd just like the entire window to stretch/scale up (in the given scenario, everything would double in size) rather than just moving around. It would be nice if it worked with images as well, but just getting the fonts and general object sizes to do this would be good.

Are there any inbuilt functions or 3rd party libraries that provide this functionality?

+1  A: 

You can take a look at the implementation of the ColorPicker control here: http://livegeometry.codeplex.com/SourceControl/changeset/view/34720#405553 especially MeasureOverride, ArrangeOverride and ComputeScaleFactor. m_Scale is the ScaleTransform that is applied to the entire control.

You can also use SizeToContent and LayoutTransform if necessary.

Kirill Osenkov
+2  A: 

If all your content has to be stretched proportionally including texts, controls and images, fix your main panel size to 200x400 and include it in a Viewbox panel.

A problem may arise when the user resizes the window in a non proportional way like to 300x400. Then depending on the Viewbox.StretchDirection and Stretch properties you may have a distorted layout or empty areas. To solve this you can constraint the window size to a certain ratio.

Mart
I believe this is what I need. Will check it out on Monday. Cheers.
mrnye