views:

38

answers:

1

hello all

i have a problem guys i made a wpf applications its running well but when i run the application on different screen resolution, then the controls(i.e. the size) added in the xbap page changes. So i want to get the current screen resolution and make the size of controls unchangable.Can anyone help me out.

thanks in advance Radhe Govind

<Window x:Class="MedSelectNew.ImageSelection"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
 xmlns:local="clr-namespace:MedSelectNew"   

Title="ImageSelection" WindowState="Maximized"  Loaded="Window_Loaded" ShowInTaskbar="False" WindowStyle="None" Background="Black" Width="{x:Static SystemParameters.PrimaryScreenWidth}" Height="{x:Static SystemParameters.PrimaryScreenHeight}" KeyDown="Window_KeyDown">

A: 

You can get the DPI-adjusted primary screen resolution from these properties:

SystemParameters.FullPrimaryScreenHeight
SystemParameters.FullPrimaryScreenWidth

It is not clear to me why you would want this, however. If you want your controls to be smaller when your window is smaller, just use WPF's layout capabilities along with ViewBox. If not, just give all your controls the same size. Either way I don't see how the current screen resolution comes into the picture.

Ray Burns