WPF 全屏后任務欄被遮擋


開始有個需求是自定義任務欄,但是在使用【Application.Current.MainWindow.WindowState = WindowState.Maximized;】做到最大化得時候使用 發現窗口最大化了會遮擋任務欄, 網上搜索了一下,原來指定窗口得最大長款就行了

 

<Window x:Class="EvalutionScaner.App.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:prism="http://prismlibrary.com/"
        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        xmlns:model="clr-namespace:EvalutionScaner.App.Models"
        xmlns:consts="clr-namespace:EvalutionScaner.App.Models.Consts"
        xmlns:i ="http://schemas.microsoft.com/xaml/behaviors"
        mc:Ignorable="d"
        Title="MainWindow"
        TextElement.Foreground="{DynamicResource MaterialDesignBody}"
        Background="{DynamicResource MaterialDesignPaper}"
        prism:ViewModelLocator.AutoWireViewModel="True"
        x:Name="mainWindow"
        WindowStyle="None" 
        MaxHeight="{StaticResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}"
        MaxWidth="{StaticResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}"
    xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
    xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters;assembly=MaterialDesignThemes.Wpf">
.....界面代碼......
<Window>

  紅色為對應得設置屬性,思路就是把窗口得最大寬度和最大高度分別綁定屏幕得長寬


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM