Errors when using MVVM...

Docking/MDI for WPF Forum

Posted 13 years ago by SledgeHammer01
Version: 11.1.0543
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar
I'm using the MVVM features on the MDI container. I noticed that as I open & close documents, I get alot of binding errors. Seems like its doing what its supposed to be doing though.

System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=Content; DataItem='Track' (Name=''); target element is 'TabbedMdiContainer' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'TabTintColor' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=SelectedItem.TabTintColor; DataItem='TabbedMdiContainer' (Name=''); target element is 'TabbedMdiContainer' (Name=''); target property is 'OutlineTintColor' (type 'Color')
System.Windows.Data Error: 40 : BindingExpression path error: 'CanCloseResolved' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=SelectedItem.CanCloseResolved; DataItem='TabbedMdiContainer' (Name=''); target element is 'TabbedMdiContainer' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'BorderThickness' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=SelectedItem.BorderThickness; DataItem='TabbedMdiContainer' (Name=''); target element is 'Border' (Name=''); target property is 'BorderThickness' (type 'Thickness')
System.Windows.Data Error: 40 : BindingExpression path error: 'BorderBrush' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=SelectedItem.BorderBrush; DataItem='TabbedMdiContainer' (Name=''); target element is 'Border' (Name=''); target property is 'BorderBrush' (type 'Brush')
System.Windows.Data Error: 40 : BindingExpression path error: 'Background' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=SelectedItem.Background; DataItem='TabbedMdiContainer' (Name=''); target element is 'Border' (Name=''); target property is 'Background' (type 'Brush')
System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=Content; DataItem='Track' (Name=''); target element is 'TabbedMdiContainer' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=Content; DataItem='Track' (Name=''); target element is 'TabbedMdiContainer' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=Content; DataItem='Track' (Name=''); target element is 'TabbedMdiContainer' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=Content; DataItem='Track' (Name=''); target element is 'TabbedMdiContainer' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=Content; DataItem='Track' (Name=''); target element is 'TabbedMdiContainer' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''Track' (Name='')'. BindingExpression:Path=Content; DataItem='Track' (Name=''); target element is 'TabbedMdiContainer' (Name=''); target property is 'NoTarget' (type 'Object')

Comments (4)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

It looks like you are trying to bind to the TabbedMdiContainer's ItemsSource property, and using it's ItemContainerStyle property. This is not supported, as the TabbedMdiContainer element can be created/destroyed dynamically as elements are moved around the DockSite. In addition, you would be unable to undock any of the items from the TabbedMdiContainer (as the Items collection cannot be changed), nor could you dock any new windows in there.

We have examples of using the DockSite's DocumentItemsSource and ToolItemsSource in our Sample Browser that use the basic MVVM pattern. In addition, we include a seperate sample that leverages Prism.


Actipro Software Support

Posted 13 years ago by SledgeHammer01
Avatar
Hi,

I based my code on your samples. My DockSite is defined like this:

<Style x:Key="DocumentItemStyle" TargetType="{x:Type docking:DockingWindow}">
<Setter Property="Title" Value="{Binding Title}" />
</Style>

<docking:DockSite local:DockSiteViewModelBehavior.IsManaged="True" themes:ThemeManager.Theme="{Binding ElementName=mainWindow, Path=(themes:ThemeManager.Theme)}"
DocumentItemsSource="{Binding Documents}" DocumentItemContainerStyle="{StaticResource DocumentItemStyle}">

<docking:SplitContainer FocusVisualStyle="{x:Null}">

<docking:ToolWindowContainer>

<docking:ToolWindow Title="State &amp; County" Focusable="False">
<local:StateCountyCtrl />
</docking:ToolWindow>

</docking:ToolWindowContainer>

<docking:Workspace Focusable="False" FocusVisualStyle="{x:Null}">
<docking:TabbedMdiHost Focusable="False">
<docking:TabbedMdiContainer SelectedValue="{Binding ActiveDocument}" />
</docking:TabbedMdiHost>
</docking:Workspace>

</docking:SplitContainer>

</docking:DockSite>

if I remove the DocumentItemContainerStyle, I still get the binding errors and I don't have the title anymore. I am binding DocumentItemsSource as you can see, and not ItemsSource.

Unless I am misunderstanding what you are saying? As I have the code right now, I am not seeing any issues of moving the documents around?? I do not allow for floating documents, just floating tool windows. The one toolwindow is statically created in the XAML.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The only possible problem is your Style targets DockingWindow, when it should probably target DocumentWindow. But, I tried unsuccessfully to duplicate the binding errors.

If you can please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.

Or if you can recreate this with our MVVM sample, then please give detailed steps to reproduce the issue.


Actipro Software Support

Posted 13 years ago by SledgeHammer01
Avatar
I tried changing the style to target DocumentWindow and got the same binding errors. I'll have to get back to you on the sample since apperently I have a deadline that I was not told about until now :).

[Modified at 06/24/2011 12:03 PM]
The latest build of this product (v24.1.2) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.