views:

733

answers:

2

I'm developing an application that needs to be resolution independent. The application will always be full screen so I have to design my UI so that the monitor resolution will not impair the use of the application. I've been spending a good amount of time playing around with WPF trying to accomplish this. Today I found out about the Viewbox. It seems to solve all my problems. All I have to do is place the Grids used to layout each screen in Viewboxes and like magic I have a resolution independent application.

However, this just seems to easy. It doesn't feel right. Should I be using Viewboxes? If not what should I do instead? Before I found out about the Viewbox I was having difficulty coming up with a way to scale the font sizes with respect to resolution. With a Viewbox I don't have to worry about this. So if a Viewbox is the wrong thing to use, how do I go about resizing my text?

+4  A: 

WPF has resolution independence at its core. Its default measurement is in Device Independent Pixels (DIPs), not pixels. Can you explain how this is not working for you, and perhaps provide a very simple example of XAML that is not scaling correctly?

HTH, Kent

Kent Boogaart
My biggest problem has been with the fonts. Everything else I've, for the most part, been able mess around with enough to come up with some sort of layout that seems to work across resolutions. However, the screens I have done, have taken a lot of time.
Dan Vogel
Any general tips on how to ensure my windows display the same across resolutions? And how to hand font scaling?
Dan Vogel
+2  A: 

Actually, you're quite right. WPF IS resolution independent, but the problem is how you control font sizing.

ViewBoxes should be avoided, because they cost performance, but I think a single one shouldn't hurt anybody.

But beware: It may look right now, but you simply can't display as much information with 640x480 as with 1600x1200... The most elegant solution is to use resolution dependent templates which are demonstratet in the Photo Suru app.

Hades32
resolution dependent templates? Does that mean have a template for each resolution and at run time determine which to use? That seems like a lot of work.
Dan Vogel
Of course not. It only means to have several layouts dependent on resolution: For example for people with 800x600 and less you only display a list, and for people with bigger displays you additionally display some extra info panel.
Hades32