Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable window chrome by using C# code and not XAML?

So I am using the WPFShell to apply chrome to a custom window. I have learned from this article that in order to use it, I have to reference the Microsoft.Windows.Shell library and use this XAML code:

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

My question is, how do I enable chrome by using C# code and not XAML? (i.e. How do I apply chrome in code-behind?)

like image 791
IneedHelp Avatar asked Sep 03 '25 16:09

IneedHelp


1 Answers

Ah, stupid me. It was easy:

WindowChrome.SetWindowChrome(this, new WindowChrome());
like image 72
IneedHelp Avatar answered Sep 05 '25 07:09

IneedHelp