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

Adding RadPane to RadPaneGroup Programatically

2 Answers 229 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 23 Oct 2009, 02:56 AM
Hi Everyone,

I need to be able to add a RadPane control to a RadPaneGroup Programatically. I am using the following code to add the new RadPane to a RadPaneGroup that is declared in XAML.

PnlVehicleStatus = new RadPane 
    CanFloat = true
    CanDockInDocumentHost = false
    CanUserPin = true
    Title = "Vehicle Status"
    Header = "Vehicle Status"
    CanUserClose = true
    IsPinned = true
    Name = "PnlVehicleStatus"
    Tag = "Test" 
}; 
PnlVehicleStatus.SetValue(RadDocking.SerializationTagProperty,"PnlVehicleStatus"); 
PnlVehicleStatus.Content = new GeoHostVehicleStatus(); 
AddWindowToToggle(PnlVehicleStatus, (string)PnlVehicleStatus.Header); 
RSCDockRight.AddItem(PnlVehicleStatus, DockPosition.Right); 

<RadDock:RadDocking x:Name="Docking" Grid.Row="2" LayoutUpdated="RadDocking_LayoutUpdated"
            <RadDock:RadSplitContainer> 
                <RadDock:RadPaneGroup x:Name="RSCDockLeft"
                </RadDock:RadPaneGroup> 
            </RadDock:RadSplitContainer> 
            <RadDock:RadSplitContainer  InitialPosition="DockedRight"
                <RadDock:RadPaneGroup x:Name="RSCDockRight"
                </RadDock:RadPaneGroup> 
            </RadDock:RadSplitContainer> 
            <RadDock:RadDocking.DocumentHost> 
                <RadDock:RadPaneGroup> 
                    <RadDock:RadPane x:Name="PnlMain" RadDock:RadDocking.SerializationTag="PnlMain"
                    </RadDock:RadPane> 
                </RadDock:RadPaneGroup> 
            </RadDock:RadDocking.DocumentHost> 
 
 
        </RadDock:RadDocking> 


This code ends with an null reference exception being called on the additem call.

Any help in figuring out why I am getting a null reference exception would be appreciated.

Thank you in advance.

2 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 23 Oct 2009, 08:20 AM
Hi Ryan,

What I suspect is that you are trying to add the pane at the right side of a pane group that is not added in a SplitContainer yet and this is not possible, because it cannot detect in which SplitContainer the new pane should be added. Only adding to the center of a pane group is allowed before the group is placed in a SplitContainer.

As I don't know what the goal is - to add the newly created pane next to the group or in it, I cannot give a concrete advise what to do. Because of the title of the thread I assume you need to add the pane in the group, so you just need to change the last line of code to RSCDockRight.AddItem(PnlVehicleStatus, DockPosition.Center);
Hope this helps.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Radhakrishnan
Top achievements
Rank 1
answered on 27 Sep 2012, 03:02 AM
Can somebody show How to programmatically create a RadPaneGroup and attach a it to a dynamically created RadSplitContainer?!!Regards
RK
Tags
Docking
Asked by
Ryan
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Radhakrishnan
Top achievements
Rank 1
Share this question
or