Question

I am trying to find the control template of the close button on a WPF window. so far i could not find anything on the web. Only thing that might get close is FluidKit created a glass window and they did the template themselves. I cannot use licensed stuff so that is why I am looking for the current default template. I wonder is there is 3rd party app that can allow extracting the full template of a window currently running, that would same lot of time.

Any hint appreciated.

Was it helpful?

Solution

If you realy need to pick Another CloseButton I would reccomend this guide: http://blog.magnusmontin.net/2013/03/16/how-to-create-a-custom-window-in-wpf/ It is tested and works fine, You create your custom window like Sheridan said. The Close button in that code is this line:

<Button x:Name="closeButton" Style="{StaticResource WindowButtonStyle}"
                                        Content="r" />

Where the "r" represent the normal X we see in our topp right corner.

OTHER TIPS

The 'Close' button on a Window is not an editable part of WPF. What that button, along with the Minimise and Maximise buttons looks like is actually defined by the operating system that the .NET Framework is currently running on. Therefore, the Close button will look different on different operating systems.

It is of course possible to completely replace the Window with your own custom one with whatever buttons that you feel like adding... perhaps that is what you are trying? Either way, you might like to read the Custom Window Chrome in WPF article on MSDN Blogs to see what is possible, although that won't help you design your own Close button graphics either.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top