This is a migrated thread and some comments may be shown as answers.

RadPanels xaml and dynamic

1 Answer 102 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Shannon Fender
Top achievements
Rank 1
Shannon Fender asked on 27 Apr 2009, 04:23 PM

Hello, I'm trying to use RadSplitpanels / RadPanels / Docking.
Basically, i have 1 "Main" pane. setup as the DocumentHost.

When the user first hits the page, i'd like 3 panes to Defualt to being shown on the screen, docked at various parts of the "Main" pane. User should be allowed to close the Docked Panels, Move them, group them, etc.. and click a button to get any closed panes back.

this all sounds easy, but it isn't quite working as i was expecting.

here a code sample:

 

 

 

        <telerikDocking:RadDocking x:Name="docking" Margin="-8,0,8,0" > 
            <telerikDocking:RadDocking.DocumentHost> 
                <telerikDocking:DockingPanel> 
                    <Grid> 
                        <Grid.RowDefinitions> 
                            <RowDefinition /> 
                        </Grid.RowDefinitions> 
 
                        <!- Other Content goes here -> 
 
                        <Button Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="20,0,0,0" Content="Open pane 1" Height="20" Width="160" Click="Button_Click"/>  
                        <Button  Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="180,0,0,0"  Content="Open pane 2" Height="20" Width="160" Click="Button2_Click"/>  
                        <Button Grid.Row="1"  VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="340,0,0,0" Content="Open pane 3" Height="20" Width="160" Click="Button3_Click"/>  
                    </Grid> 
                </telerikDocking:DockingPanel> 
            </telerikDocking:RadDocking.DocumentHost> 
            <telerikDocking:RadSplitContainer InitialPosition="DockedRight" x:Name="split1" Orientation="Vertical">  
                <telerikDocking:RadPaneGroup x:Name="group1">  
                    <telerikDocking:RadPane x:Name="pane1" /> 
                </telerikDocking:RadPaneGroup> 
                    <telerikDocking:RadPaneGroup x:Name="group2">  
                        <telerikDocking:RadPane x:Name="pane2" /> 
                    </telerikDocking:RadPaneGroup> 
                </telerikDocking:RadSplitContainer> 
            <telerikDocking:RadSplitContainer InitialPosition="DockedBottom" x:Name="split2" Orientation="Horizontal">  
                <telerikDocking:RadPaneGroup x:Name="group3">  
                    <telerikDocking:RadPane x:Name="pane3" /> 
                </telerikDocking:RadPaneGroup> 
            </telerikDocking:RadSplitContainer> 
        </telerikDocking:RadDocking> 
 

 
it seems that when a pane is docked & pinned, clickign the "Close" (X) button in the pane will hide the pane. I have had success with making them Re-appear.
But, if the user has undocked the pane, and then closed it. there seems to be no way to get it to reappear.

secondly;
the following code only seems to work one time.

 

MyUserControl uc1 = new MyUserControl();  
            uc1.InitialPosition = Telerik.Windows.Controls.Docking.DockState.FloatingDockable;  
            docking.Items.Add(uc1); 
"MyUserControl" in this case is a usercontrol inheriting from RadSplitContainer.


Am i just going about this completely wrong? or is this a limitation of the control? if i'm completely wrong, a code sample showing what i'm tryin to accomplish would be appreciated.

1 Answer, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 28 Apr 2009, 11:29 AM
Hello Shannon Fender,

I'm not quite sure that I understand what you are trying to do, but I'll try to help where I understand.

The DocumentHost property expects a RadSplitContainer (or something that inherits from RadSplitContainer). If you put the DockingPanel control around your Grid because of the Docking control, you can remove it - the Docking control doesn't need it. The other XAML looks OK.

About the problem with your control that inherits from the RadSplitContainer control: first of all we really don't recommend inheriting the controls if this is not necessary. If you are sure that you need to inherit it, you could use the following code to set the position of the uc1:
Telerik.Windows.Controls. RadDocking.SetDockState(uc1, Telerik.Windows.Controls.Docking.DockState.FloatingDockable) 

About the reshowing panes in all cases you can use the following static method (just add it where it is more comfortable for you):
static void ShowPane(RadPane pane) 
    if (pane.IsHidden) 
    { 
        pane.IsHidden = false
    } 
 
    var parentWindow = pane.ParentOfType<Telerik.Windows.Controls.Docking.ToolWindow>(); 
    if (parentWindow != null && parentWindow.Visibility == Visibility.Collapsed) 
    { 
        bool isDockable = pane.IsDockable; 
 
        if (!isDockable) 
        { 
            pane.MakeFloatingDockable(); 
        } 
 
        pane.MakeFloatingOnly(); 
 
        if (isDockable) 
        { 
            pane.MakeFloatingDockable(); 
        } 
    } 
 
 

I could recommend you to see our online demos and their code at
http://demos.telerik.com/silverlight/#Docking/FirstLook

as well as take a look at this blog post
blogs.telerik.com/miroslavnedyalkov/posts/09-04-22/raddocking_save_load_layout.aspx

demonstrating the docking control Save/Load capabilities (it also shows how to create a simple application with the Docking control).

Hope this helps and if you have further questions, please don't hesitate to ask.

Regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
Tags
Docking
Asked by
Shannon Fender
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Share this question
or