开发者

Resize borderless window wpf

How could I do this with wpf in开发者_开发问答stead of windows forms?


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜