void TabHost_TabItemClosing(object sender, TabItemCancelEventArgs e) { if (e.TabItem.Content is IDisposable) { ((IDisposable)e.TabItem.Content).Dispose(); } }
private void tabControl_TabItemClosing(object sender, TabItemCancelEventArgs e) { if (e.TabItem.Content is IDisposable) { (e.TabItem.Content as IDisposable).Dispose(); } e.TabItem.Content = null; // set no parent }
private void DocumentsTabControl_TabItemClosing(object sender, TabItemCancelEventArgs e) { try { var DocumentsTabControl = __HostContanier as DocumentsTabControl; var currentTab = Helper.FindParentLogicalControl <TabItem>(this); if (DocumentsTabControl != null && Equals(currentTab, sender)) { DocumentsTabControl.TabItemClosing -= new EventHandler <TabItemCancelEventArgs>(DocumentsTabControl_TabItemClosing); __HostContanier = null; __phoneIsUnload = true; Disonnect(); } } catch (Exception ex) { RosApplication.App.AddLog(ex); } }
private void QueryTabPage_TabItemClosing(object sender, TabItemCancelEventArgs e) { e.Cancel = !this.ViewModel.CloseQueryTab(e.TabItem); }