This project is read-only.

DocumentPane ItemsSource binded to generic objects

May 29, 2009 at 8:25 PM

Hi,

I would like to bind the ItemsSource of a DocumentPane to an ObservableCollection of generic objects (i.e. not inheriting from DocumentContent); I cannot use the objects directly as in standard WPF controls like TabPages, so I've tyied creating a DataTemplate in the resources of my window and using it as ItemTemplate for the DocumentPane element:

<DataTemplate x:Key="PageTemplate">
   <ad:DocumentContent></ad:DocumentContent>
</DataTemplate>

<ad:DocumentPane x:Name="documentsHost" ItemsSource="{Binding Pages}" ItemTemplate="{StaticResource PageTemplate}" SelectedItem="{Binding Path=SelectedPage, Mode=TwoWay}">
</ad:DocumentPane>

but this approach does not work. There is another way to do this?