Problems with ResizeSlot() and nested SplitContainers

Docking/MDI for WPF Forum

Posted 14 years ago by Renee Klawitter
Version: 9.1.0507
Avatar
Hi Forum!

I've two (nested SplitContainer) and want to programmtically resize them:

<docking:DockSite x:Name="dockSite" >
 <docking:SplitContainer Orientation="Horizontal">
   <docking:ToolWindowContainer x:Name="CommandContainer">
     <docking:ToolWindow x:Name="CommandToolWindow" Title="">
     </docking:ToolWindow>
   </docking:ToolWindowContainer>
 <docking:SplitContainer Orientation="Horizontal">
 <docking:ToolWindowContainer x:Name="MainContainer">
   <docking:ToolWindow x:Name="DebugOutContainer" Title="" >
      <docking:DocumentWindow x:Name="DebugOutput" Title="Status Window"
                              Description="Status and racindow"                
                              FileName="debug.rtf" IsReadOnly="True">
        <TextBox Name="DebugOutputText" BorderThickness="0" TextWrapping="NoWrap"
             Text="" 
             IsReadOnly="{Binding ElementName=debugOutput,
                         Path=IsReadOnly}"/>
      </docking:DocumentWindow>
    </docking:ToolWindow>
   </docking:ToolWindowContainer>
  </docking:SplitContainer>
 </docking:SplitContainer>   
</docking:DockSite>
When I run the following code (it's a tester so it is in my main window's contructor):

ResultControl res = new ResultControl(_dynamicSet, _mainThreadDispatcher,_debugFunction);
ToolWindow window = new ToolWindow(dockSite, "", "", new BitmapImage( 
                                     new Uri("/Resources/lock.png",UriKind.Relative)),  
                                   res );
window.Dock(MainContainer, Direction.Top);
SplitContainer= MainVertSplit(SplitContainer)VisualTreeHelperExtended.GetAncestor(MainContainer, typeof(SplitContainer));
if (null != MainVertSplit)
{
  MainVertSplit.ResizeSlots(2, 1);
}
SplitContainer MainHorzSplit = (SplitContainer)VisualTreeHelperExtended.GetAncestor(CommandContainer, typeof(SplitContainer));
if (null != MainHorzSplit)
{
  MainHorzSplit.ResizeSlots(1, 2);
}     
The horizontal SplitContainer resizes as expected, but the vertical one resizes to a ratio of 1:1 and I'dont know why.

Thank you!
Renee.

Comments (2)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Renee,

I did a quick test and this seemed to work as expected. A couple of things to keep in mind. You shouldn't reference SplitContainers or ToolWindowContainers by name. These items are created and destroyed as windows are docked/undocked/etc. So it may be that the CommandContainer is null.

If this is not your problem, then please put together a small sample project that reproduces the issue and send it over to our support address. Once we have that we can look into this further.


Actipro Software Support

Posted 14 years ago by Renee Klawitter
Avatar
Thank you for your quick reply!
I've test the code outside my contructor and it works as expected.
The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.