WPF:MaxHeight到屏幕高度
问题描述:
我怎样才能设置窗口的MaxHeight属性到屏幕高度?WPF: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
设置为
System.Windows.SystemParameters.PrimaryScreenHeight
,或者您可以使用SystemParameters.VirtualScreenHeight
你是什么屏幕意思?它是你的显示器吗?如果你不定义任何MaxHeight,那么这意味着没有MaxHeight? – Krishna
@克里希纳是的,我的意思是我的显示器。如果我不定义MaxHeight窗口增长的屏幕尺寸(高度) – sanjar14
请看我的答案 – Krishna