Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resize borderless window wpf

How could I do this with wpf instead of windows forms?

like image 468
Tono Nam Avatar asked Jun 24 '11 19:06

Tono Nam


2 Answers

You can do it by setting WindowChrome.

        /* Set Borderless Chrome to this Window */
        WindowChrome Resizable_BorderLess_Chrome = new WindowChrome();
        Resizable_BorderLess_Chrome.GlassFrameThickness = new Thickness(0);
        Resizable_BorderLess_Chrome.CornerRadius = new CornerRadius(0);
        Resizable_BorderLess_Chrome.CaptionHeight = 5.0;            
        WindowChrome.SetWindowChrome(this, Resizable_BorderLess_Chrome);

Add the above code inside the window constructor to obtain border less resizable window. Or you could use the window style setter to set the window chrome property:

<Setter Property="WindowChrome.WindowChrome">
        <Setter.Value>
            <WindowChrome CornerRadius="0" GlassFrameThickness="1" UseAeroCaptionButtons="False"/>
        </Setter.Value>
</Setter>

In addition to this you need to set ResizeMode to CanResize (or CanResizeWithGrip whatever that suits your purpose) and Window Style to None.

Refer MSDN link for more information

If you are looking for Metro UI like window please check this SO Question

like image 179
kiran Avatar answered Nov 12 '22 18:11

kiran


Here is a sample in WPF. And another blog with a different sample.

like image 5
CodeNaked Avatar answered Nov 12 '22 16:11

CodeNaked