开发者

WPF window size

开发者 https://www.devze.com 2023-02-17 00:22 出处:网络
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 SystemParamete

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

精彩评论

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