Resize WPF Window and contents depening on screen resolution
The syntax Height=”{Binding SystemParameters.PrimaryScreenHeight}” provides the clue but doesn’t work as such. SystemParameters.PrimaryScreenHeight is static, hence you shall use: <Window x:Class=”MyApp.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:tools=”clr-namespace:MyApp.Tools” Height=”{x:Static SystemParameters.PrimaryScreenHeight}” Width=”{x:Static SystemParameters.PrimaryScreenWidth}” Title=”{Binding Path=DisplayName}” WindowStartupLocation=”CenterScreen” Icon=”icon.ico” > And it would fit the whole screen. Yet, you may prefer to fit a percentage of the screen size, e.g. 90%, in … Read more