4

In WPF, I want to add a userControl in/over titlebar in Window, like this:

enter image description here

The Red part is that UserControl, and the Green part is titlebar.

Now I hope to get some suggestions from you. Need to extend the Window class or just customize the style of the Window? It's better to provide source code.

SubmarineX
  • 850
  • 5
  • 19
  • 38

2 Answers2

6

You can do this by implementing your own title bar. In order to do so set your window style to none:

WindowStyle="None"

This will mean that the window will have no control box (minimize, maximize, and close buttons) and you will need to implement your own.

You can take a look at the following links to get you started:

http://blog.magnusmontin.net/2013/03/16/how-to-create-a-custom-window-in-wpf/

http://www.codeproject.com/Articles/140267/Create-Custom-Windows-in-WPF-with-Ease

http://www.kirupa.com/blend_wpf/custom_wpf_windows.htm

How can I style the border and title bar of a window in WPF?

Good luck

Community
  • 1
  • 1
Omri Btian
  • 6,499
  • 4
  • 39
  • 65
  • like http://www.kirupa.com/blend_wpf/custom_wpf_windows.htm, will emerge some problem, such as MinWidth or MinHeight is invalid, in other words, you can make the size of window small than the min size. – SubmarineX Sep 22 '13 at 08:36
  • @SubmarineX it also uses blend which you don't have to do, but the other links may be more helpful :) – Omri Btian Sep 22 '13 at 08:42
  • is there a way to keep the window style to normal AND have controls on it at the same time? – TERIHAX Oct 02 '21 at 15:06
0

You do not need to sub-class Window. You can adjust the style for Window: http://msdn.microsoft.com/en-us/library/aa969824.aspx.

meilke
  • 3,280
  • 1
  • 15
  • 31