Null Reference with Docking

2 posts, 0 answers
  1. Brett
    Brett avatar
    15 posts
    Member since:
    Sep 2010

    Posted 10 Sep 2013 Link to this post

    I'm getting the following error when using a docking panel.

    Unhandled Error in Silverlight Application
    Code: 4004   
    Category: ManagedRuntimeError      
    Message: System.NullReferenceException: Object reference not set to an instance of an object.
       at Telerik.Windows.Controls.RadPaneGroup.OnIsInDocumentHostChanged(Boolean oldValue, Boolean newValue)
       at Telerik.Windows.Controls.RadPaneGroup.Telerik.Windows.Controls.Docking.IDocumentHostAware.set_IsInDocumentHost(Boolean value)
       at Telerik.Windows.Controls.RadSplitContainer.PrepareContainerForItemOverride(DependencyObject element, Object item)
       at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
       at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
       at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 containerIndex, DependencyObject container, Boolean needPrepareContainer)
       at System.Windows.Controls.ItemsControl.AddContainers()
       at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr nativeItemsControl) 

    Here is a copy of the xaml code that throws the error, the code is inside of a grid:
    <telerik:RadDocking   BorderThickness="0" Padding="0">
                <telerik:RadDocking.DocumentHost>
                    <telerik:RadSplitContainer>
                        <telerik:RadPaneGroup>
                            <telerik:RadMap x:Name="xMap" Height="600" InitializeCompleted="xMap_InitializeCompleted" MouseClickMode="None">
                                <telerik:InformationLayer x:Name="InformationLayer2"
                                        AllowDataTemplateForZoomLevel="True"
                                        Visibility="Collapsed" ItemTemplate="{StaticResource ZonePointTemplate}"/>
                                <telerik:InformationLayer x:Name="InformationLayer1"
                                          AllowDataTemplateForZoomLevel="True"
                                          Visibility="Collapsed"/>
                            </telerik:RadMap>
                        </telerik:RadPaneGroup>
                    </telerik:RadSplitContainer>
                </telerik:RadDocking.DocumentHost>
     
                <telerik:RadSplitContainer InitialPosition="DockedLeft">
                    <telerik:RadPaneGroup>
                        <telerik:RadPane Header="Search Tools" IsPinned="True">
                            <TextBlock Text="Search Tools" />
                        </telerik:RadPane>
                        <telerik:RadPane Header="Map Options" IsPinned="True">
                            <TextBlock Text="Map Options" />
                        </telerik:RadPane>
                        <telerik:RadPane Header="Routing" IsPinned="True">
                            <TextBlock Text="Routing" />
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
     
                <telerik:RadSplitContainer InitialPosition="DockedRight">
                    <telerik:RadPaneGroup>
                        <telerik:RadPane Header="Truck Information" IsPinned="False">
                            <TextBlock Text="Truck Information" />
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking>

    Could someone please help me find the problem with the XAML.

    Thanks for you help!
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 13 Sep 2013 Link to this post

    Hello,

    It looks like you have added the RadMap control directly to the RadPaneGroup which is causing the described exception. In order to place content in any RadPaneGroup it needs to be wrapped by a RadPane.

    The next code snippet shows how the RadDocking should be declared:
    <telerik:RadDocking ...>
        <telerik:RadDocking.DocumentHost>
            <telerik:RadSplitContainer>
                <telerik:RadPaneGroup>
     
                    <telerik:RadPane>
     
                        <telerik:RadMap ...>
                        </telerik:RadMap>
     
                    </telerik:RadPane>
     
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking.DocumentHost>
        ...
    </telerik:RadDocking>


    Regards,
    Vladi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top