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

Exception on removing a RadPane

3 Answers 94 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Gajan
Top achievements
Rank 1
Gajan asked on 25 Mar 2013, 05:12 PM
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

3 Answers, 1 is accepted

Sort by
0
Gajan
Top achievements
Rank 1
answered on 28 Mar 2013, 11:42 AM
Anyone has any suggestion on the above?

Thanks

Gajan
0
Alek
Telerik team
answered on 28 Mar 2013, 02:41 PM
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.

0
Gajan
Top achievements
Rank 1
answered on 03 Apr 2013, 04:01 PM

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

Tags
Docking
Asked by
Gajan
Top achievements
Rank 1
Answers by
Gajan
Top achievements
Rank 1
Alek
Telerik team
Share this question
or