DocumentPane DataTemplate

Jun 24, 2009 at 9:19 PM


I saw that some other threads already commented that in the current release the DocumentPane doesn't take any content that is not a DockableContent or a DocuementContent.

I think this is a design problem that could be resolved if DocuementPane (and potentially other controls in Avalon) implemented the ItemsControl properly. This would involve to have something similar to the DocumentPaneItem class available, and implement the GetContainerForItemoverride.

There are a couple of big benefits from doing that: DataTemplates can be used to display content in the DocumentPane, and most importantly: it is possible to decouple the avalondock from the application.

I'm sure you might have considered this. If so, do you think this feature could be made availale in a future release? Is there any plans for anything like that?

If you need some examples/help let me know.



Jun 25, 2009 at 1:22 PM

Thanks for your hint, I admit that didn't think about that option. The main problem of the proposed solution is that DocumentPanes as well as DockablePanes are often created on the fly as users move contents within the dockingmanager. I mean, I was thinking to add something like 'DocumentTemplate' as a DockingManager property so user code can specify a datatemplate for every document content in every documentpane.

Any thoughts?


Jul 2, 2009 at 7:27 PM

I am trying to bind the ItemsSource property of the DocumentPane to a collection of objects (as a view model), and this is not working because of this problem mentioned above. I hope that this problem will be fixed as soon as possible.

Sep 22, 2009 at 12:24 PM
Edited Sep 22, 2009 at 12:25 PM

<<Any thoughts?>>

Something like that would be helpful.  I'd like to be able to replace the syle of dock based  on the width of the window so the default presentation can be made appropriate to the width of the window.  In a control with control and data template support it will be possible to use a ControlTemplateSelector and DataTemplateSelector respectively to respond to the change in scenario. 

Using templates the underlying controls can defined as resources and shared across two or more templates.  However there are problems trying to use control resources with AvalonDock at the moment because the control generates visuals from the resources preventing sharing across templates.


Sep 22, 2009 at 12:52 PM


latest version 1.2 has a property called 'DockingManager.DocumentsSource' it can be used in MVC scenarios. Also I published an article on how to customize the DocumentPane control.

Here are the links:

What do you mean with ControlTemplateSelector? Why do you need to changed the style of the DocumentPane based on the window width?



Sep 22, 2009 at 1:07 PM

Thanks for the links I'll take a look.

<< What do you mean with ControlTemplateSelector? Why do you need to changed the style of the DocumentPane based on the window width?>>


Because if the width of the window is >= 600px I want to show three panels side-by-side.  This is an Excel application and the user may want to use application's the functionality in a custom task pane (Excel 2007) which is a docked window.  When on the side it is usually narrow (~240px).  In this scenario it will be much better to begin with a set of tabs.  If the user chooses to expand the task pane the layout should change to use the available space to make it easier to for a user to select options. 

At the moment I can do this by including the whole docking manager in a controltemplate and use a template selector to change the template used based on the task pane width.  However then I can only use the docking manager for some of the controls and it will be great to be able to use the AvalonDock to


Oct 12, 2009 at 12:18 PM
Edited Oct 12, 2009 at 12:29 PM

I have the last version of this library and I have this problem:

Let's say that I have a read only property named Documents of type  ReadOnlyObservableCollection(Of MyType)

And I have a :

DockingManager.DocumentsSource="{Binding Documents}"

Now the binding did not work and I have nothing displayed. NB: I have a DataTemplate defined for MyType.

What is the problem ??


Oct 12, 2009 at 1:00 PM


could you please post the datatemplate you use?

I also would like to invite you to take a look to this article:



Oct 12, 2009 at 5:09 PM

Hi, this is my datatemplate:

<DataTemplate DataType="{x:Type local:VM_Order}">
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                <TextBox  MaxLines="30" Text="{Binding Note}"  VerticalAlignment="Bottom" Grid.ColumnSpan="2" Grid.Row="0" />
                <Button x:Name="button" Content="{Binding Title}"  VerticalAlignment="Bottom" Grid.ColumnSpan="2" Grid.Row="1" />


as you can see, I have decorated my datatemplate with a DocumentContent tag.

however with or without this decoration, nothing happen.

and yes, I have read this article.


thinks a lot and I hope that you have the answer !

Oct 24, 2009 at 1:19 AM


I've been using the technique you describe here to customize the templates of the controls for a while, merging the different ResourceDictionary to the Application.Current.Resources.

But only now I found a problem with the FlyoutPaneWindow and potentially the floating window.

When I hide a DockableContentPane and then show it again, I'm loosing the custom styles and the original ones take over. Looking at the performance suite I realized that the FlyoutPaneWindow shows up in a different node from my main window in the visual tree.

My question is: shouldn't the flyout window find my custom resources first in the Application.Resources? Why do you (or anyone) think it is picking up the one in the theme of the avalondock assembly? Any ideas?

Many thanks again,



Jan 9, 2010 at 12:28 AM


I was coming back to this "bug" in our application and spent a bit more time trying to find out what was going on and I can relate the problem to this issue discussed here:

The problem is that because FlyoutDockablePane is internal, and has no default style overridden, when it is instantiated by the DockingManager it will pick up the style of the DockablePane (its base class) from the generic.xaml in the Avalondock library. I tried different scenarios and it appears that this problem is inherently in wpf, ie: a subclass without a default style will acquire the default style of its parent class according to the settings of the library to do style lookup, bypassing any style already loaded as a resource in the Application resources (or in the hierarchy for that matters).

My way to work around this problem was to make FlyoutDockablePane public, and then add the following style on my custom styles: 

<Style TargetType="{x:Type ad:FlyoutDockablePane}" BasedOn="{StaticResource {x:Type ad:DockablePane}}"/>            

What do you think about this issue? should FlyoutDockablePane be public after all or should I be able to reference the style in some other way?