DocumentHost Defect

4 posts, 1 answers
  1. James
    James avatar
    136 posts
    Member since:
    Nov 2008

    Posted 15 Mar 2010 Link to this post

    Hello,

    When creating a floating ToolWindow programmatically the DocumentHost is setting the first DocumentPane to be selected. So if I had a second DocumentPane selected, then opened a ToolWindow, the first DocumentPane would suddenly become selected. For example:

    <Grid> 
            <Grid.RowDefinitions> 
                <RowDefinition /> 
                <RowDefinition /> 
            </Grid.RowDefinitions> 
                <Controls:RadDocking> 
                <Controls:RadDocking.DocumentHost> 
                    <Controls:RadPaneGroup x:Name="docPaneGroup">  
                        <Controls:RadDocumentPane Header="Document 1" Title="Document 1" /> 
                        <Controls:RadDocumentPane Header="Document 2" Title="Document 2" /> 
                    </Controls:RadPaneGroup> 
                </Controls:RadDocking.DocumentHost> 
            </Controls:RadDocking> 
            <Button Content="Click" Width="100" Height="30" HorizontalAlignment="Center" Click="Button_Click" Grid.Row="1" Margin="0, 5"  /> 
        </Grid> 

    And code behind:

            public void CreateFloatingWindow() {  
                var window = new RadPane();  
                docPaneGroup.AddItem(window, DockPosition.Center);  
                window.MakeFloatingOnly();  
            }  
     
            private void Button_Click(object sender, RoutedEventArgs e) {  
                CreateFloatingWindow();  
            } 

    Can you replicate this? Am I doing anything wrong?

    I can confirm this defect was not introduced with Q1 2010.

    Regards,
    James.
  2. Answer
    Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 18 Mar 2010 Link to this post

    Hi James,

    I would like to start with pointing out the incorrect way you are using the Docking control. The RadPaneGroup has to be always placed inside a RadSplitContainer. This is an expected behavior. When you add a new RadPane in RadPaneGroup the Items property of the RadPaneGroup refreshes and as a result the selected index becomes 0. To workaround this limitations you can add another empty group in the Document host where the new panes will be added. Follow the code posted bellow.

    <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <telerikDocking:RadDocking>
                    <telerikDocking:RadDocking.DocumentHost>
                        <telerikDocking:RadSplitContainer>
                            <telerikDocking:RadPaneGroup>
                                <telerikDocking:RadDocumentPane Header="Document 1" Title="Document 1" />
                                <telerikDocking:RadDocumentPane Header="Document 2" Title="Document 2" />
                            </telerikDocking:RadPaneGroup>
                            <telerikDocking:RadPaneGroup x:Name="docPaneGroup" />
                        </telerikDocking:RadSplitContainer>
                    </telerikDocking:RadDocking.DocumentHost>
                </telerikDocking:RadDocking>
                <Button Content="Click" Width="100" Height="30" HorizontalAlignment="Center" Click="Button_Click" Grid.Row="1" Margin="0, 5"  />
            </Grid>



    Best wishes,
    Kaloyan
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. James
    James avatar
    136 posts
    Member since:
    Nov 2008

    Posted 18 Mar 2010 Link to this post

    Hi Kaloyan,

    Thanks for the tip. I guess what I'm trying to do isn't supported by the Docking control currently - that is open a ToolWindow independent of any RadPaneGroups. I can see why the selected index changes when a new pane is added, but it doesn't make sense when the pane is hosted within a ToolWindow.

    Regards,
    James
  4. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 23 Mar 2010 Link to this post

    Hello James,

    There is another approach, you can create them in runtime.

    var split = new RadSplitContainer();
    var group = new RadPaneGroup();
    var pane = new RadPane() { Header = "new pane" };
      
    group.Items.Add(pane);
    split.Items.Add(group);
    radDocking.Items.Add(split);
      
    pane.MakeFloatingOnly();


    All the best,
    Kaloyan
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top