Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF window size

Tags:

wpf

I am creating a Notepad like application in WPF. I want to set the window form height and width according to screen size . How can i get Screen height and width ?

like image 796
Durga Dutt Avatar asked Mar 13 '11 14:03

Durga Dutt


1 Answers

Just bind SystemParameters properties to your window properties.

<Window x:Class="YourWindow"
    Height="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Height}" 
    Width="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Width}">
like image 149
kyrylomyr Avatar answered Oct 13 '22 09:10

kyrylomyr