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

Dynamically Create Floating Pane

2 Answers 166 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Ernesto Morin
Top achievements
Rank 1
Ernesto Morin asked on 10 Dec 2010, 11:24 PM
I have defined a Container and a Group in XAML code.

            <telerik:RadSplitContainer x:Name="FloatingContainer" InitialPosition="FloatingDockable"
                    telerik:RadDocking.FloatingLocation="250, 50"
                    telerik:RadDocking.FloatingSize="300, 220">
                <telerik:RadPaneGroup x:Name="FloatingContainerGroup">
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>

I am trying to create a RadPane through code to add it to the group at runtime. 

FloatingContainerGroup.AddItem(newRadPane,DockPosition.Center);

My problem is that everything works fine except that I never see the FloatingPane pop up.  It works fine if I create a RadPane in XAML and then add the dynamically created new radpane.

What am I missing?

2 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 11 Dec 2010, 09:25 AM
Hi Ernesto,

In order to add a RadPane dynamically and make it floating, I would suggest you to use RadPane.MakeFloatingDockable() method. If you want to use already empty defined RadPaneGroup and add the new RadPanes to this group, please refer to the code below:

<telerik:RadSplitContainer x:Name="FloatingContainer"
                    telerik:RadDocking.FloatingLocation="250, 50"
                    telerik:RadDocking.FloatingSize="300, 220">
                <telerik:RadPaneGroup x:Name="FloatingContainerGroup">
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>


 
and in the code behind:

var pane = new RadPane { Header = "pane 1" };
            this.FloatingContainerGroup.Items.Add(pane);
            pane.MakeFloatingDockable();

But, if you want to create many floating RadPanes dynamically, it is a better aproach to define the RadSplitContainers and the RadPaneGroups in the code behind as well:

// create a new RadSplitContainer and add it to the RadDocking
            RadSplitContainer container = new RadSplitContainer();
            RadDocking.SetFloatingLocation(container, new Point(250, 50));
            RadDocking.SetFloatingSize(container, new Size(300, 220));
            this.radDocking.Items.Add(container);
 
            // create a new RadPaneGroup and place it in the RadSplitContainer
            RadPaneGroup group = new RadPaneGroup();
            container.Items.Add(group);
 
            // create a new RadPane, place it in the RadPaneGroup and make it FloatingDockable
            var pane = new RadPane { Header = "pane 1" };
            group.Items.Add(pane);
            pane.MakeFloatingDockable();

For more information about RadPanes, please refer to our online documentation - http://www.telerik.com/help/silverlight/raddocking-panes-radpane.html

I hope this helps.


Greetings,
George
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Dean Wyant
Top achievements
Rank 1
answered on 08 Feb 2011, 10:40 PM
An alternative that works for me is:

RadSplitContainer SC = new RadSplitContainer() { InitialPosition = Telerik.Windows.Controls.Docking.DockState.FloatingDockable };
RadPaneGroup PG = new RadPaneGroup();
SC.Items.Add(PG);
_Dock.Items.Add(SC);
 Pane = new RadPane();
 PG.Items.Add(Pane);
 Pane.Content = ?;
Tags
Docking
Asked by
Ernesto Morin
Top achievements
Rank 1
Answers by
George
Telerik team
Dean Wyant
Top achievements
Rank 1
Share this question
or