WPF:使用WindowState问题最大化窗口(应用程序将隐藏Windows任务栏) [英] WPF : Maximize window with WindowState Problem (application will hide windows taskbar)

查看:497
本文介绍了WPF:使用WindowState问题最大化窗口(应用程序将隐藏Windows任务栏)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将主窗口状态设置为最大化",但问题是我的应用程序将填满整个屏幕,甚至是任务栏.我究竟做错了什么 ? 我正在使用分辨率为1600 * 900的Windows 2008 R2

I have set my main window state to "Maximized" but the problem is my application will fill the whole screen even task bar. what am i doing wrong ? I'm using windows 2008 R2 with resolution : 1600 * 900

这是Xaml:

<Window x:Class="RadinFarazJamAutomationSystem.wndMain"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:local="clr-namespace:RadinFarazJamAutomationSystem"
     xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    Title="MyName"  FontFamily="Tahoma" FontSize="12" Name="mainWindow"  WindowState="Maximized"   xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:my="clr-namespace:RadinFarazJamAutomationSystem.Calendare.UC" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  Loaded="mainWindow_Loaded" FlowDirection="LeftToRight"
    ResizeMode="NoResize" Closed="mainWindow_Closed">

推荐答案

您可以使用构造函数将该窗口的MaxHeight属性设置为SystemParameters.MaximizedPrimaryScreenHeight.

You can set the MaxHeight property of that window to SystemParameters.MaximizedPrimaryScreenHeight using the constructor.

public MainWindow()
{
    InitializeComponent();
    this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
}

这篇关于WPF:使用WindowState问题最大化窗口(应用程序将隐藏Windows任务栏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆