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

2 posts, 0 answers
  1. Pieter
    Pieter avatar
    34 posts
    Member since:
    Jan 2011

    Posted 21 Nov 2011 Link to this post

    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?

  2. Pieter
    Pieter avatar
    34 posts
    Member since:
    Jan 2011

    Posted 22 Nov 2011 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top