ToolWindow loosing position and adding child to animatedCanvas

Docking/MDI for WPF Forum

Posted 9 years ago by Sasha
Version: 14.2.0611
Avatar

Hi I have two questions.

1. I have a DockSite element. In this element I have some AutoHideLeftContainers. Here is a XAML code to demonstrate one of the ToolWindows:

 <docking:DockSite.AutoHideLeftContainers>
     <docking:ToolWindowContainer>  
         <docking:ToolWindow Title="{DynamicResource UnconfirmedAlarms}" TabIndex="4"
                             CanClose="False" HasOptions="False" 
                             actiproFiles:ToolWindowTabFlashBehavior.IsFlashing="{Binding UnconfirmedAlarmIsFlashing}"
                             actiproFiles:ToolWindowTabFlashBehavior.IsStoppedWhenActivated="False">
             <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                 <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                     <StackPanel Orientation="Vertical">
                         <ComboBox />
                         <ThemedDataGrid />
			 </StackPanel>
                  </ScrollViewer>
              </DockPanel>
          </docking:ToolWindow> 
  </docking:ToolWindowContainer>
</docking:DockSite.AutoHideLeftContainers>

 Inside ThemedDataGrid we handle MouseLeftButtonUp event (we want to dock this toolWindow on mouseClick, if it is not docked). The code is :

 public void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     var dg = sender as DataGrid;
     if (null == dg) return;
            
     var stackPanel = dg.Parent as StackPanel;
     if (null != stackPanel)
     {
         var scrollViewer = stackPanel.Parent as ScrollViewer;
         if (null != scrollViewer)
         {
             var dockPanel = scrollViewer.Parent as DockPanel;
             if (null != dockPanel)
             {
                 var toolWindow = dockPanel.Parent as ToolWindow;
                 if (null != toolWindow)
                 {
                     if(toolWindow.State != DockingWindowState.Docked)
                         toolWindow.Dock();
                 }
              }
          }
      }            
 }

 So far everything works. But if to click unpin button(right upper corner of toolWindow) this ToolWindow goes to the end of the list(we have more than 1 toolWindow) and we want it to be with fixed position. Pinning and unpinning form view works without changing toolWindow position. How can we unpin element without loosing it's position?

 

2. In the DockSite we have an opportunity to add DocumentItems:

<docking:DockSite viewModels:DockSiteViewModelBehavior.IsManaged="true" CanDocumentWindowsRaft="True" ItemContainerRetentionMode="Wrapped"
                          DocumentItemsSource="{Binding DocumentItems}" ToolItemsSource="{Binding ToolItems}">

 and DocumentItem is:

<docking:DocumentWindow x:Class="Test"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
        xmlns:views="http://schemas.actiprosoftware.com/winfx/xaml/views"
        Title="{Binding Title}">
    <Grid>
        <views:AnimatedCanvas x:Name="AnimatedCanvasOfDocumentWindow" ZIndex="0"/>
    </Grid>
</docking:DocumentWindow>

 In my viewModel I want to add dynamically visual controls to AnimatedCanvas:

 CustomAnimatedCanvas.Children.Add(userControl);

 But it is placed always in the left upper corner. How can I set position to the control?

Thank you.

[Modified 9 years ago]

Comments (3)

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

Hi Sasha,

1) I'm not sure I fully understand the problem here and might need more detail.  Are you saying that you are not happy with where the tool window goes when it enters auto-hide mode (becomes a tab on the outside of the DockSite)?  If so, how would you rather it be?  Perhaps some screenshots would help. 

Or are you saying when you restore it back to a Docked state you aren't seeing it go where you want.  The Dock() method you are calling is the right thing to do to restore it to Docked state and it should go back where it was before.

2) You can arrange children of the AnimatedCanvas with these attached properties:

AnimatedCanvas.SetLeft(child, x);

AnimatedCanvas.SetTop(child, y);


Actipro Software Support

Posted 9 years ago by Sasha
Avatar

Hi,

thank you for your answer.

1. The issue is that the toolWindow does not go back where it was before. For example at the beginning a toolWindow was at the second position, and then, after it was Docked, goes back, but to last position. Not sure how can I attach here a screenshot...

 

2. It helps.

[Modified 9 years ago]

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

Hi Sasha,

Ok for restoring to auto-hide mode, that is correct.  It is moving the tabs to the bottom of the list right now.  We are working on a major reimplementation of all logic in the Docking/MDI product.  The updates should be out later this year.  We will mark down this request to try and get that feature in.


Actipro Software Support

The latest build of this product (v24.1.1) was released 22 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.