开发者

WPF window size

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜