简体   繁体   English

停止使用WPF Shell集成库调整表单大小

[英]Stop form from being resized with WPF Shell Integration Library

I am using the WPF Shell Integration library in my WPF project to provide shell functionality in my borderless form. 我在WPF项目中使用WPF Shell集成库以无边界形式提供Shell功能。 I am wondering how I can stop the form from being resized, but retain the forms ability to move and keep it's shadow? 我想知道如何停止调整表单的大小,但保留表单移动并保持阴影的能力吗? To create the form I am simply adding this to my XAML. 要创建表单,我只是将其添加到XAML中。

<shell:WindowChrome.WindowChrome>
        <shell:WindowChrome
           ResizeBorderThickness="6"
           CaptionHeight="10"
           CornerRadius="0"
           GlassFrameThickness="1">
        </shell:WindowChrome>
    </shell:WindowChrome.WindowChrome>

Simply add ResizeMode="NoResize" to the windows properties. 只需将ResizeMode =“ NoResize”添加到Windows属性。

your xaml should look like this: 您的xaml应该如下所示:

<Window x:Class="BorderLess.WindowBorderLess"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525"
   ResizeMode="NoResize" >
<WindowChrome.WindowChrome>
    <WindowChrome
       ResizeBorderThickness="6"
       CaptionHeight="10"
       CornerRadius="0"
       GlassFrameThickness="1">
    </WindowChrome>
</WindowChrome.WindowChrome>
<Grid>

</Grid>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM