This question is locked. New answers and comments are not allowed.
Hello,
I have a problem with the RadDocumentPane.
I want to offer a new RadContextMenu on my RadDocumentPanes (because I don't want the default Telerik RadContextMenu).
So when I load a new RadDocumentPane, I create a new RadContextMenu on it :
Then, I define my Action for the this.CloseAllButThis() Method :
But the following error occures (on the RemoveFromParent(); ) :
Can you give me some help ?
Regards
Jeremie
I have a problem with the RadDocumentPane.
I want to offer a new RadContextMenu on my RadDocumentPanes (because I don't want the default Telerik RadContextMenu).
So when I load a new RadDocumentPane, I create a new RadContextMenu on it :
void RadDocumentPaneLoaded(object sender, System.Windows.RoutedEventArgs e){// Cast the senderRadPane radPane = (RadPane)sender;if (radPane.IsNotNull() && radPane.Content.IsNotNull()){// Just destroy the current ContextMenuTemplate (the telerik default context Menu) to instancie a new oneradPane.ContextMenuTemplate = null;// Instanciate a new oneRadContextMenu radContextMenu = new RadContextMenu();// Instanciate the command : close all radpane but thisRadMenuItem closeAllButThisCommand = new RadMenuItem(){Command = new DelegateCommand<RadContextMenu>(this.CloseAllButThis),CommandParameter = radContextMenu,Header = "Close all but this"};radContextMenu.Items.Add(closeAllButThisCommand);// Actually, set the new context menu to the radPane we loadingRadContextMenu.SetContextMenu(radPane, radContextMenu);}}
Then, I define my Action for the this.CloseAllButThis() Method :
private void CloseAllButThis(RadContextMenu radContextMenu) { // First, get the RanePaneGroup which contains all the RadPan RadPaneGroup radPaneGroup = radContextMenu.GetClickedElement<RadDocumentPane).GetVisualParent<RadPaneGroup>(); // Also get the pane where the user right click RadDocumentPane keepDocumentPane = radContextMenu.GetClickedElement<RadDocumentPane>(); // Then, we gets all the radpane instanciate in the radpaneGroup into a ItemCollection ItemCollection currentRadPanes = radPaneGroup.Items; // Iterate on the itemcollection for (int i = 0; i < currentRadPanes.Count; i++) { if (!(currentRadPanes[i] as RadDocumentPane).Equals(keepDocumentPane)) { ((RadDocumentPane)currentRadPanes[i]).RemoveFromParent(); } }But the following error occures (on the RemoveFromParent(); ) :
{System.Exception: Une erreur HRESULT E_FAIL a été retournée à partir d'un appel à un composant COM. à MS.Internal.XcpImports.CheckHResult(UInt32 hr) à MS.Internal.XcpImports.Collection_RemoveAt[T](PresentationFrameworkCollection`1 collection, UInt32 index) à System.Windows.PresentationFrameworkCollection`1.RemoveAtImpl(Int32 index) à System.Windows.Controls.ItemCollection.RemoveAtImpl(Int32 index) à System.Windows.Controls.ItemCollection.RemoveImpl(Object value) à System.Windows.Controls.ItemCollection.RemoveInternal(Object value) à System.Windows.PresentationFrameworkCollection`1.Remove(T value) à Telerik.Windows.Controls.RadPaneGroup.RemovePane(RadPane pane) à Telerik.Windows.Controls.RadPane.RemoveFromParent() à Vcf.Common.Core.Layout.DockingLayoutManager.CloseAllButThis(RadContextMenu radContextMenu) à Vcf.Common.Core.DelegateCommand`1.Execute(Object parameter) à Telerik.Windows.Controls.RadMenuItem.ExecuteCommand() à Telerik.Windows.Controls.RadMenuItem.OnClickImpl() à Telerik.Windows.Controls.RadMenuItem.OnClick() à Telerik.Windows.Controls.RadMenuItem.ClickItem() à Telerik.Windows.Controls.RadMenuItem.HandleMouseUp() à Telerik.Windows.Controls.RadMenuItem.OnMouseLeftButtonUp(MouseButtonEventArgs e) à System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e) à MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)}Can you give me some help ?
Regards
Jeremie