DocumentItemsSource - Same View is created for all ViewModel

Docking/MDI for WPF Forum

Posted 9 years ago by apeman
Version: 11.1.0541
Avatar
The problem is: When binding ViewModels to the DocumentItemsSource of DockSite, only one instance of View is created for all ViewModels.

This behavior is similar to the standard TabControl, but it causes a lot of problems. I want to create a new instance of View for each ViewModel.

What workaround can I apply?

Thanks

    <docking:DockSite Name="dockSite" 
                      DocumentItemsSource="{Binding DocumentItems}" 
                      DocumentItemContainerStyle="{StaticResource DocumentItemStyle}"                       
                      behaviors:DockSiteViewModelBehavior.IsManaged="true">
        <docking:Workspace>
            <docking:TabbedMdiHost />
        </docking:Workspace>
    </docking:DockSite>
[Modified at 03/03/2011 06:34 PM]

[Modified at 03/03/2011 07:52 PM]

Comments (2)

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

Unfortunately, there really isn't a good workaround for this. You may be able to bind the DocumentItemsSource to a collection of Views, which you create from your ViewModels. But this really goes against the MVVM pattern.

We have a TODO item marked down to see about adding an option to load all child visuals, even the non-selected. I've added this forum post to that TODO item, so you will be notified when it's completed.


Actipro Software Support

Posted 9 years ago by apeman
Avatar
Thanks, binding to a collection of Views works!
The latest build of this product (v2019.1 build 0684) was released 12 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.