How to build a custom WPF Window in C#

David Anderson · 25K views · 2013 · 49:42

Open on YouTube

Web developmentSoftware (other)tutorial

Why Stack Overflow recommends it

Stack Overflow users link it as a worked example and starting point when they are building or debugging custom WPF window chrome.

Recommended by 0 people across 0 different months, 2013 to 2017.

What it is

A roughly 50-minute screencast by David Anderson that walks through building a custom window chrome in WPF with C#. It covers a caption with icon and title, minimize, maximize, restore and close buttons, plus window dragging and resizing, with downloadable source code.

What people said

Cites jovanMeshkov · 2013-11 · Stack Overflow · on “Developing Custom Window into Class Library in WPF”

I'm trying to develop Custom Window, which i can reuse in other applications. I know that WPF cannot derive from XAML I also tried to deploy it as Class Library, the code provided in this video: [this video] , but still it does not read the XAML file. I tried with code-behind to set the ControlTemplate, but as i read FrameworkElementFactory is deprecated... All i want to do is, derive from Window, change the ControlTemplate, release it as Class Library... anyone can show me how or point me to the right direction?

Cites Dave · 2014-03 · Stack Overflow · on “creating standard behaviour custom maximise/restore button for custom window in WPF”

I have used the example at [this video] and downloaded the source code to form the basis of my custom window chrome. i have changed the look a fair bit because it's fairly ugly looking. Additionally I have added custom images for the close, maximise and minimise buttons. However, I note that standard behaviour is for a different image to be displayed for maximise/restore based on whether the window is in a maximised or normal state at the time. has anyone got a suggestion for how to do this?

Cites ctwheels · 2017-12 · Stack Overflow · on “Why does adding ContentControl cause my application to enter break mode?”

Brief I've created a beautiful WindowChrome style to apply to my windows. When I add ContentControl to my style, however, the application enters break mode. I've pieced together code from this youtube video [this video] , this article [LINK] , this SO question [LINK] and Microsoft's documentation [LINK] and I've come up with the following code. Note : The code below is all considered relevant since the application cannot run with either of these parts (yes I know it can run without the code-behind, but it's annoying having to stop the application from Visual Studio instead of the close button - which is also what I'm trying to accomplish). I've actually slimmed down the code below so that it's ea