We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Itemssource of DocumentContainer

Hi,

I have an WPF application that uses a DocumentContainer to show multiple windows. The windows are added programmatically using the following lines of code:

TestDoc temp1 = new TestDoc();
DocumentContainer.SetHeader(temp1, "test1");
this.MyContainer.Items.Add(temp1);

Where TestDoc is just a selfmade user control.

This works, but then I found out that DocumentContainer contains the ItemsSource property. So it would be great if I could use data binding to bind to an ObservableCollection. But when I tried this I got the following error:

'Binding' cannot be set on the 'ItemsSource' property of type 'DocumentContainer'.

Is it possible to bind an ObservableCollection, for example, to the ItemsSource of the DocumentContainer?!

Thanks,

Arjan




3 Replies

PP Prabhu P Syncfusion Team April 27, 2009 07:30 PM UTC

Hi Arjan,

Thank you for your interest in Syncfusion products.

Yes. It is possible to bind an ObservableCollection data to the DocumentContainer’s ItemsSource property. We have created a simple sample to demonstrate this feature. Please find the sample from the link given below.

http://files.syncfusion.com/support/tools.WPF/7.2.0.20/80731/main.htm

Hope this will fulfill your requirement. Please let me know if you have any other queries.

Thanks,
Prabu




AV Arjan van der Stelt April 28, 2009 07:02 AM UTC

Hi,

Thank you for the fast solution for my problem, it realy helped me.
I'm now able to bind the ItemsSource to an ObservableCollection. Here is my code:

public partial class ARACWindow : RibbonWindow
{
private ObservableCollection<object> MyDocuments;
this.MyDocuments = new ObservableCollection<object>();
this.MyContainer.ItemsSource = this.MyDocuments;
}

I added the property MyDocuments to the window and set the ItemsSource of the DocumentContainer to that property.

It workes great, now I can just add controls to the ObservableCollection and they are being showed in the DocumentContainer.

Thanks,

Arjan




PP Prabhu P Syncfusion Team April 28, 2009 03:55 PM UTC

Hi Arjan,

We are glad to hear that your problem has been resolved. Please let us know if you have any other queries.

Best Regards,
Prabu



Loader.
Live Chat Icon For mobile
Up arrow icon