This project is read-only.

Binding DockablePane.ItemsSource

Nov 3, 2010 at 11:09 AM

Hello,

When I bind the DockablePane.ItemsSource it displays my DockableContent when I add one. But it throws an exception when I try to Close or Un-Pin it, moreover every configurationoptions in the contextual menu is disabled (Fixed, Floating...).

How can I use binding with DockablePane ?

Thank you.

Jan 20, 2011 at 4:56 PM

Any luck with finding out the problem? I have the exact same issue. I bind to the ItemsSource and all the options are disabled. :(

Jan 20, 2011 at 6:54 PM

No, nothing new. I gave up on DataBinding with DockablePane. 

Jan 20, 2011 at 6:58 PM

awww bummer...I was afraid of that. Thanks for the prompt update. :)

Aug 9, 2011 at 11:55 AM

Hi,

 

i think i have found a solution to get rid of the exception while closing tab.

In main window i bind to observable collection of some type like this:

<ad:DocumentPane 
ItemsSource="{Binding Path=SolutionInstance.OpenedSources,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged,
Converter={StaticResource documentConverter}}">
</ad:DocumentPane>
In converter i just wrap my object with class that inherites from DocumentContent.
And when this document gets closing event i remove it from parent pane. Something like this:

public partial class Document : DocumentContent
    {
        private UIFile _model = null;
        public Document(UIFile model)
        {
            InitializeComponent();
            this.DataContext = this._model = model;
            this.Closing += new EventHandler<System.ComponentModel.CancelEventArgs>(Document_Closing);
        }

        void Document_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var parentSources = this.ContainerPane.ItemsSource as Collection<Document>;
            parentSources.Remove(this);
        }
    }

Hope this helps you. But if you found better way please let me know.

P.S. sory for my english :)