【问题标题】:WPF: MaxHeight to screen heightWPF:MaxHeight 到屏幕高度
【发布时间】:2015-07-26 02:37:24
【问题描述】:

如何将窗口的 MaxHeight 属性设置为屏幕高度?

XAML:

<Window x:Class="RT.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="{Binding WindowTitle}" Height="300" MaxHeight="500" Width="495.149" SizeToContent="WidthAndHeight">

【问题讨论】:

  • 屏幕是什么意思?是你的显示器吗?如果你没有定义任何 MaxHeight 那么就意味着没有 MaxHeight 对吗?
  • @Krishna 是的,我的意思是我的显示器。如果我不定义 MaxHeight 窗口会超过屏幕尺寸(高度)
  • 请看我的回答

标签: wpf height screen


【解决方案1】:

在控件的代码隐藏页面中,您可以将 Window 的 MaxHeight 设置为

System.Windows.SystemParameters.PrimaryScreenHeight

或者你可以使用SystemParameters.VirtualScreenHeight

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-10
    • 1970-01-01
    • 2011-07-28
    • 2012-11-01
    • 1970-01-01
    • 2014-05-15
    • 2015-09-03
    • 1970-01-01
    相关资源
    最近更新 更多