WPF:用WindowState最大化窗口问题(应用程序将隐藏Windows任务栏)

前端之家收集整理的这篇文章主要介绍了WPF:用WindowState最大化窗口问题(应用程序将隐藏Windows任务栏)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我将主窗口状态设置为“最大化”,但问题是我的应用程序将填满整个屏幕甚至任务栏.我究竟做错了什么 ?
我使用Windows 2008 R2,分辨率为1600 * 900

这是Xaml:

  1. <Window x:Class="RadinFarazJamAutomationSystem.wndMain"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:sys="clr-namespace:System;assembly=mscorlib"
  5. xmlns:local="clr-namespace:RadinFarazJamAutomationSystem"
  6. xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
  7. Title="MyName" FontFamily="Tahoma" FontSize="12" Name="mainWindow" WindowState="Maximized" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
  8. xmlns:my="clr-namespace:RadinFarazJamAutomationSystem.Calendare.UC" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  9. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Loaded="mainWindow_Loaded" FlowDirection="LeftToRight"
  10. ResizeMode="NoResize" Closed="mainWindow_Closed">
您可以使用构造函数将该窗口的MaxHeight属性设置为SystemParameters.MaximizedPrimaryScreenHeight.
  1. public MainWindow()
  2. {
  3. InitializeComponent();
  4. this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
  5. }

猜你在找的Windows相关文章