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

PaneGroup AddItem gives "Object reference not set to an instance of an object."

1 Answer 129 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Pieter
Top achievements
Rank 2
Pieter asked on 21 Nov 2011, 02:10 PM

I dynamically built a form using a RadDocking, then a Vertical RadSplitContainer and inside the RadSpltContainer two Horizontal RadSplitContainers. The lower RadSplitContainer has three RadPaneGroups where the right outer contains three RadPanes.
The right outer container is filled like this:

radPaneGroupSystem.AddItem(ucStatusAlarms, Telerik.Windows.Controls.Docking.DockPosition.Top);
radPaneGroupSystem.AddItem(ucRSSFeed, Telerik.Windows.Controls.Docking.DockPosition.Left);
radPaneGroupSystem.AddItem(ucMessageViewer, Telerik.Windows.Controls.Docking.DockPosition.Right);

If I do that I get a "Object reference not set to an instance of an object." error, source "Telerik.Windows.Controls.Docking",
StackTrace   
at Telerik.Windows.Controls.RadPaneGroup.GetPaneGroup()
at Telerik.Windows.Controls.RadPaneGroup.AddItem(RadPane pane, DockPosition dockPosition)

If I change the code and use panegroupParent.Items.Add(ucStatusAlarms), etc I get the three RadPanes as three Tabs functioning normally.

I checked the parameters going into the AddItem call, they are normally set to an instance.
Does anyone know why the Docking gives an Object reference not set to an instance of an object error and what I can do about it?

1 Answer, 1 is accepted

Sort by
0
Pieter
Top achievements
Rank 2
answered on 22 Nov 2011, 09:49 AM
After quite some experimenting I found out that the Telerik.Windows.Controls.RadPaneGroup.AddItem(RadPane pane, DockPosition dockPosition) call needs to have a RadDocking as parent at the start of the in the visual tree.
 
Because the RadDocking isn't part of the dynamic layout I was building from the database definitition I did not have a RadDocking in the visual tree I was creating. Starting with RadDocking and building the visual tree frrom that solved the problem.
Tags
Docking
Asked by
Pieter
Top achievements
Rank 2
Answers by
Pieter
Top achievements
Rank 2
Share this question
or