簡體   English   中英

停止使用WPF Shell集成庫調整表單大小

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

我在WPF項目中使用WPF Shell集成庫以無邊界形式提供Shell功能。 我想知道如何停止調整表單的大小,但保留表單移動並保持陰影的能力嗎? 要創建表單,我只是將其添加到XAML中。

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

只需將ResizeMode =“ NoResize”添加到Windows屬性。

您的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