Exception on removing a RadPane

4 posts, 0 answers
  1. Gajan
    Gajan avatar
    13 posts
    Member since:
    Mar 2012

    Posted 25 Mar 2013 Link to this post

    Hi,

    I am adding RadPanes dynamically to RadPaneGroups in a RadDocking control. The RadPanes have a customer header datatemplate that contains a button to close it. I get the following exception on calling RemoveFromParent() on the RadPane.

    System.NullReferenceException was caught
      HResult=-2147467261
      Message=Object reference not set to an instance of an object.
      Source=Telerik.Windows.Controls.Navigation
      StackTrace:
           at Telerik.Windows.Controls.Primitives.TabStripPanel.<>c__DisplayClass14.<MeasureOverride>b__7(UIElement item)
           at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
           at System.Linq.Enumerable.Max(IEnumerable`1 source)
           at Telerik.Windows.Controls.Primitives.TabStripPanel.<>c__DisplayClass14.<MeasureOverride>b__6(Double total, List`1 next)
           at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
           at Telerik.Windows.Controls.Primitives.TabStripPanel.MeasureOverride(Size availableSize)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.ContextLayoutManager.UpdateLayout()
           at Telerik.Windows.Controls.RadPane.OnDocumentHostTemplateChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
           at System.Windows.StyleHelper.InvalidateContainerDependents(DependencyObject container, FrugalStructList`1& exclusionContainerDependents, FrugalStructList`1& oldContainerDependents, FrugalStructList`1& newContainerDependents)
           at System.Windows.StyleHelper.DoStyleInvalidations(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle)
           at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache)
           at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
           at System.Windows.FrameworkElement.UpdateStyleProperty()
           at System.Windows.TreeWalkHelper.InvalidateOnTreeChange(FrameworkElement fe, FrameworkContentElement fce, DependencyObject parent, Boolean isAddOperation)
           at System.Windows.FrameworkElement.OnVisualParentChanged(DependencyObject oldParent)
           at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent)
           at System.Windows.Media.Visual.RemoveVisualChild(Visual child)
           at System.Windows.Media.VisualCollection.RemoveRange(Int32 index, Int32 count)
           at System.Windows.Controls.UIElementCollection.RemoveRangeInternal(Int32 index, Int32 count)
           at System.Windows.Controls.Panel.OnItemsChangedInternal(Object sender, ItemsChangedEventArgs args)
           at System.Windows.Controls.Panel.OnItemsChanged(Object sender, ItemsChangedEventArgs args)
           at System.Windows.Controls.ItemContainerGenerator.OnItemRemoved(Object item, Int32 itemIndex)
           at System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
           at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
           at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
           at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
           at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
           at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
           at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
           at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
           at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
           at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
           at MS.Internal.Controls.InnerItemCollectionView._RemoveAt(Int32 index, Int32 indexR, Object item)
           at System.Windows.Controls.ItemCollection.Remove(Object removeItem)
           at Telerik.Windows.Controls.RadPaneGroup.RemovePane(RadPane pane)
           at Telerik.Windows.Controls.RadPane.RemoveFromParent()

    Even calling RemovePane on the RadPaneGroup raises the exception "Object reference not set to an instance of an object."

    I am using the version 2013.1.220.45. Any idea what can cause the above exception?

    Thank you,

    Gajan

  2. Gajan
    Gajan avatar
    13 posts
    Member since:
    Mar 2012

    Posted 28 Mar 2013 Link to this post

    Anyone has any suggestion on the above?

    Thanks

    Gajan
  3. UI for WPF is Visual Studio 2017 Ready
  4. Alek
    Admin
    Alek avatar
    78 posts

    Posted 28 Mar 2013 Link to this post

    Hello,

    We did not managed to reproduce the issue.

    In order to investigate the cause of the exception we need a code snippets containing information as follows:

    • the logic of adding dynamically a RadPane;
    • the logic how the RadPane is removed;
    • the structure of the RadDocking control;

    Regards, Alek
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Gajan
    Gajan avatar
    13 posts
    Member since:
    Mar 2012

    Posted 03 Apr 2013 Link to this post

    Thank you for getting back. 

    I have managed to overcome this by merging the theme dictionaries into application resources in code behind instead of merging the implicit style xamls in the resources section of the control containing the docking control.

    Thank you,

    Gajan

Back to Top