Custom Window Chrome in WPF

About a month ago I posted a teaser video that I would be doing a screencast on developing a fully functional custom window chrome for WPF. Well, it’s here. I did miss my mark by 8 days though, I had originally wanted to complete it by the 1st. Anyways, here’s the demo source code for the video.

Screencast Code:
Custom Window Chrome Demo_2013-03-09 21-35-24Z


  1. Thomas Heinze

    Hi David,

    nice tutorial. I’ve working your CustomWindow in my Application.
    Now I want to add a resizegrip for the template but if i add the resizegrip in the template

    I had a white resizegrip on the right site. How can i change that.

    Thanks Thomas

  2. Eugene

    Hello David

    Thanks for the great tutorial, I have been searching for hours with nothing close to what you created.

    There is one thing I am struggling with. If Window’s taskbar is set to autohide, then I cannot bring it back up by taking the mouse pointer to the bottom of the screen as with other programs. With normal WPF window it does work however, so I am guessing there is some windows parameter missing or something.

    Thanks again.

  3. Sertan

    Not sure if this is still relevant but replying just in case it might help. Without an adorner layer, adorners will not render. Adorner layer can be on the control or parent / grandparents of the control in the visual tree.
    In this case if you wrap with , Adorners used inside the window will render as expected.

  4. Sushil

    Got it working! Thanks for your useful suggestion.
    One more issue with custom chrome I was not able to use adorner layer in order to resize controls on the fly.

  5. Sushil

    Hi David,

    Thanks for creating this video as it is quite useful. Could you please tell me how can create sub a sub window/User Control with this chrome. I tried to create a second window but it is throwing “Window must be the root of the tree. Cannot add Window as a child of ” error. Someone told me that I can use User Control to do that but again I getting default window chrome. Please Help.

    1. David Anderson (Post author)

      You have to do something like:

      public class CustomWindow : Window { }
      public class SubClassedWindow : CustomWindow { }

      <myXmlNs:SubClassedWindow> …

      There isn’t such a thing as Xaml inheritance unfortunately, and you can’t nest a Window in Xaml, it must be the outer most Xaml element in the Visual Tree.


Leave a Comment

Your email address will not be published.