Hi Team,
We are using RadDock control in our application. We are adding Panes(RadPane->RadPaneGroup->RadSplitContainer) dynamically in dock control.
Now, we want to remove all panes including (RadPaneGroup/RadSplitContainer).
We write following code.
foreach (RadSplitContainer item in mainDock.Items)
{
foreach (RadPaneGroup panel in item.Items)
{
//Remove panes in a group
panel.Items.Clear();
}
//Remove group
item.Items.Clear();
}
//To remove split containers
mainDock.Items.Clear();
It is removing the all split containers/groups/panes . But again when we try to add any split container dynamically in dock control.
It’s giving us runtime error.
{MS.Internal.WrappedException: Error HRESULT E_FAIL has been returned from a call to a COM component. ---> System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
at System.Windows.Controls.Control.set_DefaultStyleKey(Object value)
at System.Windows.Controls.ItemsControl..ctor()
at MS.Internal.CoreTypes.GetCoreWrapper(Int32 typeId)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type, Boolean preserveManagedObjectReference)
at MS.Internal.XcpImports.ConvertDO(IntPtr doPointer, Int32 typeIndex, Boolean releaseObjectReference)
at MS.Internal.XcpImports.ConvertType(CValue outVal, Int32 typeIndex, Boolean releaseObjectReference, Boolean deleteBuffer, IManagedPeerBase fromObject)
at MS.Internal.XcpImports.Collection_GetItemDependencyObject[T](PresentationFrameworkCollection`1 collection, Int32 index)
at System.Windows.PresentationFrameworkCollection`1.GetItemDependencyObject(Int32 index)
at System.Windows.Controls.UIElementCollection.GetItemImplSkipMethodPack(Int32 index)
at System.Windows.PresentationFrameworkCollection`1.CollectionEnum`1.get_Current()
at System.Windows.PresentationFrameworkCollection`1.CollectionEnum`1.System.Collections.IEnumerator.get_Current()
at System.Linq.Enumerable.<OfTypeIterator>d__aa`1.MoveNext()
at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Telerik.Windows.Controls.DockingPanel.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
--- End of inner exception stack trace ---}
[MS.Internal.WrappedException]: {MS.Internal.WrappedException: Error HRESULT E_FAIL has been returned from a call to a COM component. ---> System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
at System.Windows.Controls.Control.set_DefaultStyleKey(Object value)
at System.Windows.Controls.ItemsControl..ctor()
at MS.Internal.CoreTypes.GetCoreWrapper(Int32 typeId)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type, Boolean preserveManagedObjectReference)
at MS.Internal.XcpImports.ConvertDO(IntPtr doPointer, Int32 typeIndex, Boolean releaseObjectReference)
at MS.Internal.XcpImports.ConvertType(CValue outVal, Int32 typeIndex, Boolean releaseObjectReference, Boolean deleteBuffer, IManagedPeerBase fromObject)
at MS.Internal.XcpImports.Collection_GetItemDependencyObject[T](PresentationFrameworkCollection`1 collection, Int32 index)
at System.Windows.PresentationFrameworkCollection`1.GetItemDependencyObject(Int32 index)
at System.Windows.Controls.UIElementCollection.GetItemImplSkipMethodPack(Int32 index)
at System.Windows.PresentationFrameworkCollection`1.CollectionEnum`1.get_Current()
at System.Windows.PresentationFrameworkCollection`1.CollectionEnum`1.System.Collections.IEnumerator.get_Current()
at System.Linq.Enumerable.<OfTypeIterator>d__aa`1.MoveNext()
at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Telerik.Windows.Controls.DockingPanel.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
--- End of inner exception stack trace ---}
Data: {System.Collections.ListDictionaryInternal}
InnerException: {System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
at System.Windows.Controls.Control.set_DefaultStyleKey(Object value)
at System.Windows.Controls.ItemsControl..ctor()
at MS.Internal.CoreTypes.GetCoreWrapper(Int32 typeId)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type, Boolean preserveManagedObjectReference)
at MS.Internal.XcpImports.ConvertDO(IntPtr doPointer, Int32 typeIndex, Boolean releaseObjectReference)
at MS.Internal.XcpImports.ConvertType(CValue outVal, Int32 typeIndex, Boolean releaseObjectReference, Boolean deleteBuffer, IManagedPeerBase fromObject)
at MS.Internal.XcpImports.Collection_GetItemDependencyObject[T](PresentationFrameworkCollection`1 collection, Int32 index)
at System.Windows.PresentationFrameworkCollection`1.GetItemDependencyObject(Int32 index)
at System.Windows.Controls.UIElementCollection.GetItemImplSkipMethodPack(Int32 index)
at System.Windows.PresentationFrameworkCollection`1.CollectionEnum`1.get_Current()
at System.Windows.PresentationFrameworkCollection`1.CollectionEnum`1.System.Collections.IEnumerator.get_Current()
at System.Linq.Enumerable.<OfTypeIterator>d__aa`1.MoveNext()
at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Telerik.Windows.Controls.DockingPanel.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)}
Message: "Error HRESULT E_FAIL has been returned from a call to a COM component."
StackTrace: null
If I remove the following line from the code, Its not giving any error in adding another splitcontainer dynamically, having panes. But in that case, empty containers remain in the items collection.
//To remove split containers
mainDock.Items.Clear();
Please see above code and check this is a correct way to remove/ clear panes & parents(RadPanelGroup/RadSplitConatiner) docking control. We have set HasDocumentHost="False" property
of docking control.
Regards,
Nidhi