This project is read-only.

[Updated] Creating new DocumentContent makes content inactive

Nov 4, 2010 at 3:21 PM
Edited Nov 5, 2010 at 6:11 PM

Original Post:

I have a weird issue I can't seem to nail down, but I believe I have narrowed it down to avalon dock.

I have a DocumentHost with a DocumentContent. The content has a user control with a button that opens a new DocumentContent in the DocumentHost (a new tab).

When I click the button to add the new DocumentContent, My previous user control, the one that had the button to create the new tab, because un-useable, ie i can't click any of the buttons, none of the textbox's.

Its like the click event is getting ate up somewhere, and I can't seem to figure out where.

In debugging, if I create the DocumentContent in xaml before hand, and when I click the button just set the content of the tab, the previous control is fine, i can click everything. But i really need to create the new document content only when the button is clicked...

Btw, great job on the library, many thanks.

Update:

After doing some more debugging, if I add a new tab, or close off a tab that already existed, the controls inside documentContent no long work, ie can't click them. Do I need to do something to keep track of the tabs? Here is the xaml for the main window:

<Window x:Class="Controls.Main"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Scenarion Generator" Height="880" Width="1687"
        xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
        xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:controls="clr-namespace:"Controls" WindowStyle="ThreeDBorderWindow" Closed="Window_Closed">
    <Grid Background="#FF9CAAC1">
        <Grid.RowDefinitions>
            <RowDefinition Height="24"/>
            <RowDefinition Height="24"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="24"/>
        </Grid.RowDefinitions>

        <Menu Background="#FF333333" Foreground="White">
            <MenuItem Header="File" Foreground="White">
                <MenuItem Header="Log In"/>
                <MenuItem Header="Exit"/>
            </MenuItem>
            <MenuItem Header="Navigation" Foreground="White"></MenuItem>
            <MenuItem Header="Help" Foreground="White">
                <MenuItem Header="About"/>
            </MenuItem>
        </Menu>
        <controls:StandardToolBar x:Name="toolBar" Grid.Row="1" Background="#FF343333" />
        <ad:DockingManager x:Name="DockManager" IsAnimationEnabled="True" Grid.Row="2"
                    >
                <ad:ResizingPanel Orientation="Horizontal">
                <ad:ResizingPanel Orientation="Vertical" ad:ResizingPanel.ResizeWidth="340" HorizontalAlignment="Left">
                    <ad:DockablePane Name="docPaneConfig" SelectedIndex="0" VerticalAlignment="Top">
                        <controls:TDLDBLogin IsCloseable="False" Title="Login" x:Name="Login" ConnectionEvent="Connected"/>
                        <controls:TesterControl x:Name="TestConfiguration" Title="Test Configuration"/>
                    </ad:DockablePane>
                    <ad:DockablePane Name="targetTerminalPane" Width="Auto" Visibility="Hidden" VerticalAlignment="Top">
                        <controls:TargetTerminalListBox x:Name="targetTerminalListBox" Title="Target Terminal"/>
                    </ad:DockablePane>
                </ad:ResizingPanel>
                <ad:DocumentPane x:Name="DocumentHost" SelectedIndex="0" SelectionChanged="DocumentHost_SelectionChanged">
                    <ad:DocumentContent Name="Welcome" IsFloatingAllowed="False" IsLocked="True" Title="Welcome">
                        <controls:WelcomePage/>
                    </ad:DocumentContent>
                    <ad:DocumentContent Name="Doc1" IsFloatingAllowed="True" IsLocked="False" Title="Test Case Events"></ad:DocumentContent>
                    <ad:DocumentContent Name="test" IsFloatingAllowed="False" IsLocked="True" Title="test">
                    </ad:DocumentContent>
                    </ad:DocumentPane>
                <ad:ResizingPanel Orientation="Vertical"  ad:ResizingPanel.ResizeWidth="350">
                    <ad:DockablePane  Name="sourceControlPane" >
                        <controls:FileViewer x:Name="fileViewer"/>
                    </ad:DockablePane>
                    <ad:DockablePane  Name="propertiesPane" >
                        <controls:PropertyGridListView x:Name="propertyGrid"/>
                    </ad:DockablePane>
                </ad:ResizingPanel>
            </ad:ResizingPanel>
        </ad:DockingManager>
        <StatusBar Grid.Row="3" Background="#FF293955">
            <StatusBarItem Content="Ready" Foreground="White"/>
        </StatusBar>
    </Grid>
</Window>
Am I missing something? Any Help would be much appreciated...
Nov 5, 2010 at 7:42 PM

Another Update:

If you change the demo app in MainWindow.Xaml

 

line: 129 ----> <local:SampleDockableContent/> instead of <TextBox/>,

ie put a dockable content into the tab, you can the issue. None of the buttons such as Test Click! are able to be activated. This leads me to believe that I am filling in the content incorrectly for the DocumentContent, but I am not sure the correct way to achieve this.

Again, any help will be much appreciated.

Nov 8, 2010 at 4:21 PM

I'm having exactly the same issue as well. I had to go back to 1.2 for this one. Any help on this is much appreciated!

Nov 8, 2010 at 5:11 PM

Well I figured out what the problem was.

 

Apparently a dockablePane's content cannot inherit from DockableContent. So I switched my controls back to UserControl and it worked fine. Not sure if this is intended or not but it seemed to fix the issues.