Reputation: 4113
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 ?
Upvotes: 5
Views: 21765
Reputation: 12652
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}">
Upvotes: 13
Reputation: 84684
See System.Windows.SystemParameters
You have properties like
PrimaryScreenWidth
PrimaryScreenHeight
VirtualScreenHeight
VirtualScreenWidth
WorkArea
etc.
This question might help as well: How can I get the active screen dimensions?
Upvotes: 8