Deriving MdiChild causes windows without titlebar

Mar 16, 2010 at 9:56 AM

I have strange effect. I can add MdiChild to the main window without a problem. But when I create custom child window derived from MdiChild there is no titlebar after adding it to container.

 

Am I missing something or there is strange quirk/bug in the MDI library?

Aug 18, 2010 at 6:45 PM
Edited Aug 18, 2010 at 6:48 PM
I've had this same problem, and just solved it. There is an issue with inheriting styles in WPF - you have to assign it manually: In your class deriving MdiChild, place this block at the top: static YourClass() { DefaultStyleKeyProperty.OverrideMetadata(typeof(YourClass), new FrameworkPropertyMetadata(typeof(YourClass))); } In the XAML for that, assign the style to YourClass based on that for MdiChild: <mdi:MdiChild.Resources> <Style TargetType="{x:Type local:YourClass}" BasedOn="{StaticResource {x:Type mdi:MdiChild}}" /> </mdi:MdiChild.Resources> where the mdi namespace is defined as: xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI" and the local namespace is defined as: xmlns:local="clr-namespace:YourNamespace" Much credit to this post on SO - http://stackoverflow.com/questions/1729161/wpf-custom-derived-control-style There are still some issues such as focusing, but those fixes are probably simple overrides.