Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
830
Bug Report: ArgumentNullException, Value cannot be null. Parameter name: pane
posted

I'm trying to style ContentPane. Everything works well, up until I'm dragging pane from the DocumentContentHost....

 

Let's take an example with the following XAML code:

 

<Window x:Class="ContentPaneStylingBug.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:igDock="http://infragistics.com/DockManager"

        Title="MainWindow" Height="350" Width="700">

    <Grid>

        <igDock:XamDockManager Grid.Row="1" x:Name="xamDockManager1">

            <igDock:XamDockManager.Panes>

                <igDock:SplitPane SplitterOrientation="Horizontal" igDock:XamDockManager.InitialLocation="DockedLeft" MinWidth="200">

                    <igDock:ContentPane Header="Solution Explorer" />

                </igDock:SplitPane>

                <igDock:SplitPane SplitterOrientation="Horizontal" igDock:XamDockManager.InitialLocation="DockedRight" MinWidth="200">

                    <igDock:ContentPane Header="Properties Window" />

                </igDock:SplitPane>

            </igDock:XamDockManager.Panes>

            <igDock:DocumentContentHost>

                <igDock:SplitPane>

                    <igDock:TabGroupPane Margin="5">

                        <igDock:ContentPane Header="Function1" />

                        <igDock:ContentPane Header="Function2" />

                        <igDock:ContentPane Header="Function3" />

                    </igDock:TabGroupPane>

                </igDock:SplitPane>

            </igDock:DocumentContentHost>

        </igDock:XamDockManager>

    </Grid>

</Window>

 

 

 

Now drag for example  "Function2" to the left ContentPane just like in the following pictures:

 

  

Now, let's take the project and edit the style of the ContentPane in Blend.

We get the following XAML (using Edit Template à Edit a Copy):

<Window x:Class="ContentPaneStylingBug.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:igDock="http://infragistics.com/DockManager"

        Title="MainWindow" Height="350" Width="700">

       <Window.Resources>

              <Style x:Key="ContentPaneStyle1" TargetType="{x:Type igDock:ContentPane}">

                     <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>

                     <Setter Property="BorderBrush" Value="{DynamicResource DockManagerBrushKeys.ContentPaneBorderFillKey}"/>

                     <Setter Property="BorderThickness" Value="1"/>

                     <Setter Property="TabHeader">

                           <Setter.Value>

                                  <Binding Path="Header" RelativeSource="{RelativeSource Self}">

                                         <Binding.Converter>

                                                <igDock:ContentValidationConverter ErrorMessage="[Error: The Header of the ContentPane is set to an element. The Header is used as the default TabHeader and in the PaneNavigator. An element cannot be shown in multiple locations. Set the HeaderTemplate to the element that should be displayed in the pane caption and navigator and set the TabHeader or TabHeaderTemplate as needed.]"/>

                                         </Binding.Converter>

                                  </Binding>

                           </Setter.Value>

                     </Setter>

                     <Setter Property="FocusVisualStyle" Value="{x:Null}"/>

                     <Setter Property="Template">

                           <Setter.Value>

                                  <ControlTemplate TargetType="{x:Type igDock:ContentPane}">

                                         <AdornerDecorator>

                                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">

                                                       <DockPanel Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">

                                                              <igDock:PaneHeaderPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" DockPanel.Dock="Top" Visibility="{TemplateBinding HeaderVisibility}"/>

                                                              <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Visibility="{TemplateBinding ContentVisibility}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                                                       </DockPanel>

                                                </Border>

                                         </AdornerDecorator>

                                  </ControlTemplate>

                           </Setter.Value>

                     </Setter>

              </Style>

       </Window.Resources>

    <Grid>

        <igDock:XamDockManager Grid.Row="1" x:Name="xamDockManager1">

            <igDock:XamDockManager.Panes>

                <igDock:SplitPane SplitterOrientation="Horizontal" igDock:XamDockManager.InitialLocation="DockedLeft" MinWidth="200">

                    <igDock:ContentPane Header="Solution Explorer" Style="{DynamicResource ContentPaneStyle1}" />

                </igDock:SplitPane>

                <igDock:SplitPane SplitterOrientation="Horizontal" igDock:XamDockManager.InitialLocation="DockedRight" MinWidth="200">

                    <igDock:ContentPane Header="Properties Window" />

                </igDock:SplitPane>

            </igDock:XamDockManager.Panes>

            <igDock:DocumentContentHost>

                <igDock:SplitPane>

                    <igDock:TabGroupPane Margin="5">

                        <igDock:ContentPane Header="Function1" />

                        <igDock:ContentPane Header="Function2" />

                        <igDock:ContentPane Header="Function3" />

                    </igDock:TabGroupPane>

                </igDock:SplitPane>

            </igDock:DocumentContentHost>

        </igDock:XamDockManager>

    </Grid>

</Window>

 

 

Do the same thing of dragging "Function2" to the left ContentPane.
You will get ArgumentNullException.... "Value cannot be null. Parameter name: pane".

At Infragistics.Windows.DockManager.DockManagerUtilities.ThrowIfNull

 

 

 

Anyway to still style the ContentPane, but bypass this exception?

10x

Parents
  • 54937
    Verified Answer
    Offline posted

    It's usually better to start with a copy of the xaml then to use Blend to infer the template since it can lose some information. In this case add the following to the PaneHeaderPresenter in that template:

    DataContext="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}}"

Reply Children