wpfresizegrip

hide the default resize grip in wpf


I have a borderless and transparent window in WPF, with some fancy decoration at the bottom. There's a custom footer with some non conventional curves and what not showing the company logo. This window needs to be resizable with a grip in the bottom right corner like conventional windows.

Anyways, I have put my own ResizeGrip in a place that is actually on the footer, however the default grip still shows up and it's floating in space due to the invisible window.

How do I hide the default ResizeGrip?


Solution

  • The appearance of a resize grip is controlled via the ResizeMode dependency property on the Window.

    If this is set to CanResizeWithGrip:

    <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="50" Width="150" 
            WindowStyle="None" AllowsTransparency="True" Background="#19FFFFFF"
            ResizeMode="CanResizeWithGrip">
        <Grid></Grid>
    </Window>
    

    The Window will look like this:

    With Grip

    If it is set to CanResize (the default):

    <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="50" Width="150" 
            WindowStyle="None" AllowsTransparency="True" Background="#19FFFFFF"
            ResizeMode="CanResize">
        <Grid></Grid>
    </Window>
    

    The Window will look as follows:

    Can Resize