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

RadSplitContainer causing NullReferenceException

1 Answer 94 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Sarah asked on 29 Nov 2012, 05:53 PM
We recently upgraded to Telerik RadControls for Silverlight Q3 2012 (version 2012.3.1017) and now a bug has cropped up in our xaml that was working.
We're getting a NullReferenceException in your code when GetParentDocking is returning null every time we click on a tab.

Here's where where the problem is starting in our xaml.

         <Controls:Toolbar Orientation="Horizontal" VerticalContentAlignment="Center" Controls:DockPanel.Dock="Top" >
             <Components:ToolButton />
             <Components:ToolButton />
         <radDock:RadSplitContainer InitialPosition="DockedTop" radDock:RadDocking.SerializationTag="HostContainer" >
             <radDock:RadPaneGroup x:Name="HostPaneGroup" TabOrientation="Horizontal" TabStripPlacement="Top" radDock:RadDocking.SerializationTag="HostPaneGroup" >

I'm guessing it has to do with the fact there's a DockPanel between the RadSplitContainer and the DocumentHost?
I'm not entirely sure why it was coded this way to begin with and I'm having trouble tweaking the xaml to get it to work as well as look the same.

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 04 Dec 2012, 08:59 AM
Hi Sarah,

Placing a container different than RadSplitContainer in RadDocumentHost is not supported. It seems that introducing one of our features caused this exception at your side. The best way to resolve this would be to create a template for the DocumentHost and place there the DockPanel and the toobar you use. Here is sample code using the RadControls:
    <Style TargetType="telerik:DocumentHost">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="MinWidth" Value="25" />
        <Setter Property="MinHeight" Value="25" />
        <Setter Property="Template">
                <ControlTemplate TargetType="telerik:DocumentHost">
                        <telerik:RadToolBar x:Name="DisplayAreaTabToolbar" Orientation="Horizontal" VerticalContentAlignment="Center" telerik:RadDockPanel.Dock="Top" />
                        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                            <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Grid x:Name="LayoutRoot" Background="White">
    <telerik:RadDocking x:Name="DisplayViewRadDock" AllowDragReorder="True"  Background="#FFC6DFFF">
                <telerik:RadSplitContainer InitialPosition="DockedTop" telerik:RadDocking.SerializationTag="HostContainer" >
                    <telerik:RadPaneGroup x:Name="HostPaneGroup"   TabOrientation="Horizontal" TabStripPlacement="Top" telerik:RadDocking.SerializationTag="HostPaneGroup" >
                        <telerik:RadPane Header="Pane 4" />
                        <telerik:RadPane Header="Pane 5" />
                        <telerik:RadPane Header="Pane 6" />
                <telerik:RadPane Header="Pane 1" />
                <telerik:RadPane Header="Pane 2" />
                <telerik:RadPane Header="Pane 3" />

the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question