How to display two ToolWindows as docked?

Docking/MDI for WPF Forum

Posted 10 months ago by Yuki
Version: 21.1.3
Avatar

Hello,

I want to display two ToolWindows as docked.

How to do it by using MVVM?

I checked "MVVM ToolWindows" sample. The sample is three ToolWindows.

I changed constructor of  MainViewModel as the following, then two ToolWindows are displayed by divided.

--> Is this expected behavior?

I also checked Live Visual Tree. There were two ToolWindowContainer.

		/// <summary>
		/// Initializes a new instance of the <see cref="MainViewModel"/> class.
		/// </summary>
		public MainViewModel() {
			//toolItems.Add(new ToolItem1ViewModel());  --> comment out
			//toolItems.Add(new ToolItem2ViewModel() { State = ToolItemState.Document });
			toolItems.Add(new ToolItem3ViewModel() { State = ToolItemState.Docked, DefaultDockSide = ToolItemDockSide.Left });
			toolItems.Add(new ToolItem3ViewModel() { State = ToolItemState.Docked, DefaultDockSide = ToolItemDockSide.Left });

			foreach (var toolItem in toolItems)
				toolItem.IsOpen = true;
		}

Comments (2)

Answer - Posted 10 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

When I use your code above in the latest v22.1 codebase, I see two "Tool 3" tool windows docked to the left of the tabbed MDI area.  There is a single ToolWindowContainer and it contains both tool windows attached to each other (tabbed) in the same space.  This is expected behavior.

Is that what you are seeing?  If not, please describe in more detail.  You mentioned you were on an older version, so also try the latest 22.1 version and check if you see the same.


Actipro Software Support

Posted 10 months ago by Yuki
Avatar

I'm sorry to trouble you.

I changed constructor of  MainViewModel as the following, then two ToolWindows are displayed by divided.

It was because of my modification of sample project.

I wanted to display ToolWindow on the entire window.

I solved it by changing as the following.

    <!-- DockSite -->
    <docking:DockSite x:Name="dockSite"
      ToolItemContainerStyle="{StaticResource ToolWindowStyle}"
      ToolItemTemplateSelector="{StaticResource ToolItemTemplateSelector}"
      ToolItemsSource="{Binding ToolItems}" >
      <docking:DockHost />
    </docking:DockSite>
The latest build of this product (v22.1.4) was released 23 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.