开始有个需求是自定义任务栏,但是在使用【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>
红色为对应得设置属性,思路就是把窗口得最大宽度和最大高度分别绑定屏幕得长宽