簡體   English   中英

在WPF中隱藏默認的resizegrip

[英]Hide the default resizegrip in wpf

是否可以在wpf中隱藏默認的大小調整夾點,我有一個自定義窗口,側面沒有手柄,目前正在使用:

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="100" Width="200" ResizeMode="CanResizeWithGrip">
    <Grid></Grid>
</Window>

我知道可以更改ResizeMode="CanResize"但這是我可以想到的調整窗口大小的唯一方法。

是的,您可以從窗口中刪除默認的調整大小夾點。 您需要覆蓋WindowTemplate。 這是在XAML中的處理方式:

<Window x:Class="MyNamespace.MyWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        WindowStyle="None" 
        ResizeMode="CanResizeWithGrip"
        AllowsTransparency="True">
    <Window.Template>
        <ControlTemplate>
            <Border>

            </Border>
        </ControlTemplate>
    </Window.Template>
</Window>

在“邊框”內將顯示所有需要在窗口中顯示的內容(例如,文本框)。 然后,如果您想要自定義ResizeGrip,則也可以定義它。 希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM