This project is read-only.

About DockableContent

Dec 11, 2009 at 12:47 AM

Hello.

I just download the source code,and modify the Windows2 in sample.I want to click the button and show the DockableContent.But it doesn't work, and when I resize the form, the DockableContent shown very strange.

My xaml:

<ad:DockingManager x:Name="dockManager">
			<ad:ResizingPanel Orientation="Vertical">
				<ad:ResizingPanel Orientation="Horizontal">
					<ad:DocumentPane x:Name="documentsHost">
						<ad:DocumentContent Title="File1.doc">
							<RichTextBox/>
						</ad:DocumentContent>
						<ad:DocumentContent Title="File2.doc">
							<Button x:Name="btn1" Click="btn1_Click" Content="click" Width="300" Height="50" ></Button>
						</ad:DocumentContent>
					</ad:DocumentPane>
				</ad:ResizingPanel>
				<ad:DockablePane ad:ResizingPanel.ResizeHeight="200" x:Name="pane">
					
				</ad:DockablePane>
			</ad:ResizingPanel>
		</ad:DockingManager>

and cs file:
private void btn1_Click(object sender, RoutedEventArgs e)
        {
            DockableContent dc = new DockableContent();
            TextBox tb = new TextBox();
            dc.Content = tb;
            dc.HideOnClose = true;
            this.pane.Items.Add(dc);
            this.dockManager.Show(dc);
        }

how can I do?

Dec 11, 2009 at 5:47 AM

ok.I can specify the DockableContentState.FloatingWindow as parameter to Show method.

But I want to dock the panel when I click the button immediatly

Dec 14, 2009 at 12:31 AM

I found a mistake in DockingManager.cs.

The source code:

content.ContainerPane.SelectedItem = content;
                    content.SetAsActive();
                    DockablePane dockParent = content.ContainerPane as DockablePane;
                    if (content.ActualWidth == 0.0 && (
                        dockParent.Anchor == AnchorStyle.Left|| dockParent.Anchor == AnchorStyle.Right))
                    {
                        ResizingPanel.SetResizeWidth(dockParent, new GridLength(200));
                        ResizingPanel.SetEffectiveSize(dockParent, new Size(200, 0.0));
                    }
                    else if (content.ActualWidth == 0.0 && (
                         dockParent.Anchor == AnchorStyle.Left || dockParent.Anchor == AnchorStyle.Right))
                    {
                        ResizingPanel.SetResizeWidth(dockParent, new GridLength(200));
                        ResizingPanel.SetEffectiveSize(dockParent, new Size(200, 0.0));
                    }

Look at the two conditions,they are the same. I think maybe one of the them just like this:

content.ActualWidth == 0.0 && (
                        dockParent.Anchor == AnchorStyle.Top| dockParent.Anchor == AnchorStyle.Bottom)

And the two blocks are the same two,why use if...else if here?