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

RadSplitContainer causing NullReferenceException

1 Answer 94 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Sarah
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:RadDocking.DocumentHost>
   <Controls:DockPanel>
         <Controls:Toolbar Orientation="Horizontal" VerticalContentAlignment="Center" Controls:DockPanel.Dock="Top" >
             <Components:ToolButton/>
             <Components:ToolButton />
             <Components:ToolButton />
             <Components:ToolButton/>
         </Controls:Toolbar>
         <radDock:RadSplitContainer InitialPosition="DockedTop" radDock:RadDocking.SerializationTag="HostContainer" >
             <radDock:RadPaneGroup x:Name="HostPaneGroup" TabOrientation="Horizontal" TabStripPlacement="Top" radDock:RadDocking.SerializationTag="HostPaneGroup" >
             </radDock:RadPaneGroup>
        </radDock:RadSplitContainer>
    </Controls:DockPanel>
</Controls:RadDocking.DocumentHost>


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
0
Ivo
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:
<UserControl.Resources>
    <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">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:DocumentHost">
                    <telerik:RadDockPanel>
                        <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}" />
                        </Border>
                    </telerik:RadDockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</UserControl.Resources>
  
  
<Grid x:Name="LayoutRoot" Background="White">
    <telerik:RadDocking x:Name="DisplayViewRadDock" AllowDragReorder="True"  Background="#FFC6DFFF">
        <telerik:RadDocking.DocumentHost>
                <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:RadPaneGroup>
                </telerik:RadSplitContainer>
        </telerik:RadDocking.DocumentHost>
        <telerik:RadSplitContainer>
            <telerik:RadPaneGroup>
                <telerik:RadPane Header="Pane 1" />
                <telerik:RadPane Header="Pane 2" />
                <telerik:RadPane Header="Pane 3" />
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking>

Greetings,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Docking
Asked by
Sarah
Top achievements
Rank 1
Answers by
Ivo
Telerik team
Share this question
or