3 DockablePanes with Auto Width

Nov 5, 2011 at 4:09 PM

Hi,

I have 3 DockablePane´s, and i want to set the width property in my Codebehind file... but it doesent work...

 

XAML

    <ad:DockingManager x:Name="DockManager" IsAnimationEnabled="False"  >
        <ad:ResizingPanel Orientation="Horizontal">
            <ad:DockablePane x:Name="dp1" SelectedIndex="1" >
                <ad:DockableContent x:Name="dc1" IsCloseable="False" IsHitTestVisible="False" IsTabStop="False" Selector.IsSelected="False"  Width="{Binding ElementName=dp1, Path=ActualWidth}"/>
            </ad:DockablePane>
            <ad:DockablePane x:Name="dp2" >
                <ad:DockableContent x:Name="dc2" IsCloseable="False"  Width="{Binding ElementName=dp2, Path=ActualWidth}"/>
            </ad:DockablePane>
            <ad:DockablePane x:Name="dp3">
                <ad:DockableContent x:Name="dc3" IsCloseable="False"  Width="{Binding ElementName=dp3, Path=ActualWidth}" />
            </ad:DockablePane>
        </ad:ResizingPanel>
    </ad:DockingManager>

 

C#

            DockManager.Width = DockManager.ActualWidth;
            dp1.Width = 300;
            dp2.Width = (DockManager.Width - dp1.Width)/2;
            dp3.Width = (DockManager.Width - dp1.Width) / 2;

 

Why dosent it work?

My visible Pannel width is 1/3 of the Screen width... but the pennel-header-width is changing..

 

THX!!!

 

greetz,

Benny

Nov 6, 2011 at 2:22 AM

 

When are you executing those four lines of C# code?  It works for me if I set the DockablePane width values in 
the Window's ContentRendered event handler.  You can use the same code in the SizeChanged handler if your
window permits resizing.  I also sized the DockManager to the ActualWidth of it's container (in my case, a StackPanel).

 

  
        private void Window_ContentRendered(object sender, EventArgs e)
        {
            ReSizeDockableContent();
        }

        private void ReSizeDockableContent()
        {
            DockManager.Width = stp1.ActualWidth;
            dp1.Width = 300;
            dp2.Width = (DockManager.Width - dp1.Width) / 2;
            dp3.Width = (DockManager.Width - dp1.Width) / 2;
        }

        private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            ReSizeDockableContent();
        }

<StackPanel Orientation="Vertical" Name="stp1">
        <ad:DockingManager Height="200" x:Name="DockManager"  
                           Width="{Binding ElementName=stp1,Path=ActualWidth}">
            <ad:ResizingPanel Orientation="Horizontal">
                <ad:DockablePane x:Name="dp1" SelectedIndex="1" >
                    <ad:DockableContent x:Name="dc1" IsCloseable="False" IsHitTestVisible="False" IsTabStop="False" Selector.IsSelected="False"  
                                        Width="{Binding ElementName=dp1, Path=ActualWidth}"/>
                </ad:DockablePane>
                <ad:DockablePane x:Name="dp2" >
                    <ad:DockableContent x:Name="dc2" IsCloseable="False"  Width="{Binding ElementName=dp2, Path=ActualWidth}"/>
                </ad:DockablePane>
                <ad:DockablePane x:Name="dp3">
                    <ad:DockableContent x:Name="dc3" IsCloseable="False"  Width="{Binding ElementName=dp3, Path=ActualWidth}" />
                </ad:DockablePane>
            </ad:ResizingPanel>
        </ad:DockingManager>
    </StackPanel>