I am creating a Notepad like application in WPF. I want to set the window form height and width according to screen si开发者_Go百科ze . How can i get Screen height and width ?
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}">
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?
精彩评论