private void AddValueToRadPaneGroup(object item, bool show) { var lst = new List <object>(); foreach (var t in Panes.EnumeratePanes()) { lst.Add(t); var ff = t.Content; if (ff != null) { lst.Add(ff); } } if (lst.Contains(item)) { Panes.RadPaneGroupOverride.SelectedItem = item; if (show) { this.Visibility = Visibility.Visible; this.Show(); this.Focus(); } return; } var radPane = item as RadPane; if (radPane != null) { radPane.IsHidden = false; if (radPane.Parent != null) { radPane.RemoveFromParent(); } Panes.RadPaneGroupOverride.Items.Add(item); return; } var userControl = item as UserControl; if (userControl != null) { try { var radDocumnetPane = new RadDocumentPane(); radDocumnetPane.IsHidden = false; var parent = userControl.Parent; if (parent != null) { parent.SetValue(ContentPresenter.ContentProperty, null); } var mvvm = userControl.DataContext as IITab; if (mvvm != null) { radDocumnetPane.Header = mvvm.Title; radDocumnetPane.CanUserClose = mvvm.CanClose; radDocumnetPane.CanDockInDocumentHost = mvvm.CanDockInDocumentHost; radDocumnetPane.CanUserPin = mvvm.CanUserPin; radDocumnetPane.CanFloat = mvvm.CanFloat; } else { radDocumnetPane.Header = userControl.Name; radDocumnetPane.CanUserClose = true; radDocumnetPane.CanDockInDocumentHost = true; radDocumnetPane.CanUserPin = true; radDocumnetPane.CanFloat = true; } radDocumnetPane.Content = item; Panes.RadPaneGroupOverride.Items.Add(radDocumnetPane); } catch (Exception ex) { ex.ToString(); } if (show) { this.Visibility = Visibility.Visible; this.Show(); this.Focus(); } } }