Theme and floating window questions

Jun 29, 2010 at 11:30 AM

I'm starting out using AvalonDock and I like it a lot but I have some questions (and more will come I'm sure):

1. I'm using the VS2010 theme. Now I apply the theme in code behind by doing the below:

            string uri = "/AvalonDock.Themes;component/themes/dev2010.xaml";
            ThemeFactory.ChangeTheme(new Uri(uri, UriKind.RelativeOrAbsolute));

Can this be done in XAML instead?

2. Is it possible to not render the floating window when it's dragged around? Like in real VS 2010 where only grey borders are shown when dragging a window around.

3. In one of my dockable panes I've a datagrid. That datagrid's itemssource is bound to an observablecollection in the main views viewmodel. This is all good but when I start dragging that dockable pane so that it becomes a floating window, the binding seems to be lost. I assume that is because the floating window is now seperated from the main view and cannot access the main view's viewmodel. But how can this be worked around?

Thanks for help!

Jun 29, 2010 at 2:08 PM

1) you can specify theme in xaml, i always set mine in app.xaml :

                <ResourceDictionary Source="pack://application:,,,/AvalonDock.Themes;Component/Themes/dev2010.xaml"/>

2) *shrug*

3) See post on the subject :

Jun 29, 2010 at 2:57 PM

2) Its not an available option at moment, content is always rendered while dragging, sorry,


Jun 29, 2010 at 8:46 PM

Thanks for your replies guys.

On question 3 I still don't fully get the workaround proposed here:

"A short fix is to always bind to an application level datacontext. You can find an example of this into the demo project (look for "EmployeeInfoDataSource")."

What does that mean more in detail? I checked the example but how is that "application" level? Isn't that also just window level meaning that when a window becomes floating the binding is lost?

Also, there is a link to another workaround on that issue tracker but that link is not working. Is there an updated link? Below is the broken link:

Thanks for help!



Jun 29, 2010 at 8:54 PM
Edited Jun 29, 2010 at 8:56 PM

I get around issue three by setting DockableContent.Content and DockableContent.DataContext to properties that are static.







Jun 29, 2010 at 10:04 PM

Thanks again. I came up with a solution that I'm sure need some more work. I added an event handler to the DockableContent and handled the event like this:

        private void DockableContent_StateChanged(object sender, RoutedEventArgs e)
            FrameworkElement fe = sender as FrameworkElement;
            if (fe.DataContext == null)
                fe.DataContext = this.DataContext;

This solved some issues but some remains with datatemplates etc. (at least in my case). Is this an acceptable solution or can anyone tell of any pitfalls?

Also: Is it possible to get the floating window as a reference for code behind or is it equivalent with the dockableContent?