如果想要窗口大小一致保持固定大小, 且不能使用鼠标拉大或者缩小 需要将 width 和 height 的两组值保持一致, 即:

  • Width, MinWidth, MaxWidth 设置为相同值
  • Height, MinHeight, MaxHeight 设置为相同值

同时设置 ResizeMode="NoResize", 如下所示:

<Window x:Class="Rsser.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"
        mc:Ignorable="d"
        Title="MainWindow"
        Width="340" MinWidth="340" MaxWidth="340"
        Height="600" MinHeight="600" MaxHeight="600"
        ResizeMode="NoResize">
</window>