I'm currently using Telerik RadDocking to create an application which uses Prism, and MEF.
I'm using the region adapter recommended for adapting RadPanes to "regions".
I have two panes that are correctly added to the "bottom" region:
1) First pane (Console) has a TextBox which is bound to a string property, StringContent, in the data context.
2) Second pane (Errors List) has a DataGrid which is bound to an IEnumerable property, Errors, in the data context.
The panes have their data context set using MEF Import statements, in the XAML code behind:
, Justification =
"Needs to be a property to be composed by MEF"
.DataContext = value;
When I first launch the application, the Console pane is selected in the bottom region, and the StringContent is correctly displayed in the TextBox. When I select the Errors List pane (clicking the tab), the datagrid is properly filled.
However, when I go BACK to the Console pane, it is no longer updating/showing the StringContent value in the TextBox. Similarly, if I navigate BACK to the Errors List pane, it is no longer showing the Errors contents. Using Snoop, I was able to find the following error:
System.Windows.Data Error: 40 : BindingExpression path error: 'StringContent' property not found on 'object' ''ErrorListViewModel' (HashCode=14361357)'. BindingExpression:Path=StringContent; DataItem='ErrorListViewModel' (HashCode=14361357); target element is 'Label' (Name=''); target property is 'Content' (type 'Object')
You can see here, that it appears that the data context of the panes are somehow getting switched during tab navigation. Obviously this bug breaks both panes, as they are no longer capable of displaying the correct data to the end user.
What do you recommend for resolving this?