A couple of Docking questions

Docking/MDI for WPF Forum

Posted 14 years ago by John Dunn
Version: 10.1.0521
Avatar
1. Is there an example on how to custom style the MDI tab host? I've downloaded the XAML styles but there's a lot going on there. I'd like it to look like my custom ( non docking ) TabView. So going from this to this. Mainly removing the border around the docked window and changing the tab drawing style.

2. I have commands that are bound to my main window. When a Document is 'floated', I need to bind these commands to the floating window so the accelerators still work. Is there a OnFloat event that I can attach to when the window is floated? I'll also need to do some other things like set the Transform on the contents of the window.

Comments (5)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi John,

1. We don't currently have an example, but have marked down a TODO item to add a sample. But you should be able to take the Style referenced by DockingCommonDictionary.TabbedMdiDocumentStyleKey and tweak it to your needs.

We do use that Style as the basis for implicit Styles (for DocumentWindow and ToolWindow) in the TabbedMdiHost resources, so you may need to do that as well. Otherwise, our original version of the Style may still be picked up first. I would try without first though.

2. We have a TODO item to add a new StateChanged event, which is at the top of our list. In the meantime, you may be able to use an implicit Style with a Trigger based on State changing to Float. The include a Setter for an attached behavior that hooks up your commands and/or changes the transforms.


Actipro Software Support

Posted 14 years ago by John Dunn
Avatar
Thanks. A few more questions on styling.

1. I create the DocumentWindows in code but would like to set some of their properties in XAML through a style. I tried the following

    <Style 
      x:Key="_DocumentWindowStyle"
      TargetType="{x:Type docking:DocumentWindow}"
      BasedOn="{StaticResource {x:Type docking:DocumentWindow}}">
      <Setter Property="TabBorderBrushSelected" Value="Red"/>
    </Style>

DocumentWindow doc = new DocumentWindow(_DockSite)
{
  Style = Resources["_DocumentWindowStyle"] as Style
};
But after doing so the tabs fail to show up. The style is showing up in the debugger as being BasedOn the correct style. Is there a way to add some setters to the style without reimplementing the whole thing? Although I'm guessing I'll have to reimplement to change the tab shape.

2. I have modified the TabbedMdiContainer style to get closer to my desired look. I can't figure out where the color for the border between the tabs and the content window comes from ( see here ). Any hints?
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi John,

1. You shouldn't set the Style directly like that, as the Style used changes based if the Document is docked or floating. If you prevent the documents from floating, then you would need to base your style on "{StaticResource {x:Static themes:DockingCommonDictionary.TabbedMdiDocumentStyleKey}}". The implicit Style for the DocumentWindow is defined in the resources for the TabbedMdiContainer, so it would not be used by your Style (as your style would be above it).

2. I believe that is the TabBarSpacerBorderBrush property.


Actipro Software Support

Posted 14 years ago by John Dunn
Avatar
For (2), how do I go about setting that? It appears the property exists on the ToolWindowContainer, but my XAML doesn't contain one of those

  <docking:DockSite 
    x:Name="_DockSite" 
    WindowOpened="_DockSite_WindowOpened" 
    WindowClosed="_DockSite_WindowClosed">
    <docking:Workspace>
      <docking:TabbedMdiHost IsCloseButtonOnTab="True">
        <docking:TabbedMdiContainer>
        </docking:TabbedMdiContainer>
      </docking:TabbedMdiHost>
    </docking:Workspace>
  </docking:DockSite>
The documentation states that the DockSite has a single child control which can be a SplitContainer, ToolWindowContainer or Workspace. In my case it's a workspace so I don't have a ToolWindowContainer.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi John,

Sorry, I thought you were referring to ToolWindowContainer. For TabbedMdiContainer, you can set OutlineBackground, OutlineInnerBorderBrush, and/or OutlineOuterBorderBrush. Alternatively, you could set OutlineTintColor, which would automatically set the previous 3 properties with a brush tinted to the color you specify.

The DocumentWindow/ToolWindow is responsible for drawing the "tab" portion, so setting the properties above will only change the outline around the content. DocumentWindow/ToolWindow have several "Tab*" brush properties that can be used to customize the look of the tab. Again, there is a TabTintColor, which can be used to tint the brushes towards a color.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.