Hello,
we have a problem with the headertemplate of the contentpane in a DockManager. I've tried several binding paths and ancestortypes. But none of them worked. The vs2010 output let me know:
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=(0); DataItem='ContentPane' (Name=''); target element is 'PaneToolWindow' (Name=''); target property is 'Title' (type 'String').
The message is clear to me, but I don't know how to get the correct datacontext. My current, non-working solution is:
<DataTemplate x:Key="headerTemplate"> <TextBlock Text="{Binding RelativeSource={RelativeSource FindAncestor, Mode=FindAncestor, AncestorType={x:Type igDock:ContentPane}}, Path=Content.DataContext.DisplayName}"/> </DataTemplate>
<DataTemplate x:Key="headerTemplate"> <TextBlock Text="{Binding RelativeSource={RelativeSource FindAncestor, Mode=FindAncestor, AncestorType={x:Type igDock:ContentPane}}, Path=Content.DataContext.DisplayName}"/>
</DataTemplate>
So my contentview has a DataContext with property DisplayName.
Thanks in advance
Christian
Hello Christian,
Thank you for your post. I have been looking into it, but I cannot be completely sure how your data is organized and how your source is set, so could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
Hello Stefan,
I've created a little samplesolution. To keep it simple I've put the ciew directly into the ContentPane. Normally this view would be injected by prism.
In the XamDockManager's regionadapter the datacontext of the contentpane is set to the viewmodel of the view
container.DataContext = view.DataContext;
So the binding expression is a little different. But the Datastrucure is the same. ContentPane => View => ViewModel