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

Adding Pane with CanDockInDocumentHost=true error

1 Answer 40 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Radoslaw
Top achievements
Rank 1
Radoslaw asked on 03 Dec 2011, 10:23 AM
Hi !
I've got simple docking like this:
<telerik:RadDocking>
    <telerik:RadDocking.DocumentHost>
        <telerik:RadSplitContainer>
            <telerik:RadPaneGroup  x:Name="MainPaneGroup">
                <telerik:RadPane                          
                    x:Name="MainPane"
                    Header="Main"                        
                    CanUserClose="False">
                    <Button Content="Add" Width="60" Height="20" Click="Button_Click" />
                </telerik:RadPane>
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking.DocumentHost>
</telerik:RadDocking>

In code behind I'm trying to add new Pane to this PaneGroup:
RadPane newPane= new RadPane();
 newPane.Title = "New pane";
 newPane.Header = "New pane";
 newPane.CanDockInDocumentHost = true;
 newPane.Tag = "tag";
 newPane.CanUserClose = true;
MainPaneGroup .Items.Add(newPane);
 RadDocking.SetSerializationTag(newPane, "abc");
But if  I receive an Exception:
{System.NullReferenceException: Object reference not set to an instance of an object.
   w Telerik.Windows.Controls.Docking.PaneGroupBase.OnPaneCommandCanExecute(Object sender, CanExecuteRoutedEventArgs e)
   w Telerik.Windows.Controls.CommandBinding.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
   w Telerik.Windows.Controls.CommandManager.CanExecuteCommandBinding(Object sender, CanExecuteRoutedEventArgs e, CommandBinding commandBinding)
   w Telerik.Windows.Controls.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   w Telerik.Windows.Controls.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   w Telerik.Windows.Controls.CommandManager.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
   w Telerik.Windows.Controls.CanExecuteRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
   w Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   w Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
   w Telerik.Windows.RouteItem.InvokeHandler(RadRoutedEventArgs routedEventArgs)
   w Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
   w Telerik.Windows.EventRoute.InvokeHandlers(Object source, RadRoutedEventArgs args)
   w Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
   w Telerik.Windows.DependencyObjectExtensions.RaiseEvent(DependencyObject element, RadRoutedEventArgs e)
   w Telerik.Windows.Controls.RoutedCommand.CanExecuteImpl(Object parameter, UIElement target, Boolean& continueRouting)
   w Telerik.Windows.Controls.RoutedCommand.CanExecuteInternal(Object parameter, UIElement target, Boolean& continueRouting)
   w Telerik.Windows.Controls.RoutedCommand.CanExecute(Object parameter, UIElement target)
   w Telerik.Windows.Controls.RadMenuItem.CanExecuteApply()
   w Telerik.Windows.Controls.RadMenuItem.OnCommandTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   w Telerik.Windows.PropertyMetadata.PropertyChangeHook.OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   w System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
   w System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   w System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)
   w System.Windows.Data.BindingExpression.SendDataToTarget()
   w System.Windows.Data.BindingExpression.SourceAcquired()
   w System.Windows.Data.BindingExpression.System.Windows.IDataContextChangedListener.OnDataContextChanged(Object sender, DataContextChangedEventArgs e)
   w System.Windows.Data.BindingExpression.DataContextChanged(Object sender, DataContextChangedEventArgs e)
   w System.Windows.DataContextChangedEventHandler.Invoke(Object sender, DataContextChangedEventArgs e)
   w System.Windows.FrameworkElement.OnDataContextChanged(DataContextChangedEventArgs e)
   w System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)
   w System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)
   w System.Windows.FrameworkElement.OnPropertyChanged(DependencyProperty dp)
   w System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
   w System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   w System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
   w System.Windows.FrameworkElement.set_DataContext(Object value)
   w Telerik.Windows.Controls.RadPane.OnContextMenuTemplateChanged()
   w Telerik.Windows.Controls.RadPane.OnContextMenuTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
   w Telerik.Windows.PropertyMetadata.PropertyChangeHook.OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   w System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
   w System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   w System.Windows.DependencyObject.InvalidateProperty(DependencyProperty property)
   w MS.Internal.FrameworkCallbacks.InvalidateProperty(IntPtr nativeTarget, UInt32 propertyId)}

Exception does not appeart if I change the CanDockInDocumentHost property of new Pane to FALSE.
But I do want to have ability to dock new pane in DocumentHost.

Can someone show me the solution ?

1 Answer, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 05 Dec 2011, 04:59 PM
Hello Radoslaw,

Could you please share with us which version of the controls you are using. I used your code and tried to reproduce the issue with the latest official release, i.e. Q3 2011, but to no avail.
Could you please share with us some more details about your application, or ideally open a support ticket and send us a sample project in which we can observe the issue. In that way we will be able to provide you with solution in a timely manner.

Looking forward to your reply.

Regards,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Docking
Asked by
Radoslaw
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Share this question
or