Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
Binding ContentPane's Header to a Property in the Viewmodel of the Content.
posted

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>

So my contentview has a DataContext with property DisplayName.

Thanks in advance

Christian