void OnColumnChooserClicked(object value) { if (columnChooser == null) { BindingList <ColumnVisibility> columnsVisiblityMapping = new BindingList <ColumnVisibility>(); foreach (var col in _columns) { columnsVisiblityMapping.Add(new ColumnVisibility { Name = col.Header.ToString(), IsVisible = col.Visibility == Visibility.Visible }); } columnChooser = new RSVColumnChooser { Owner = Window.GetWindow(this), ColumnsVisiblityMapping = columnsVisiblityMapping }; columnChooser.CheckedUnChecked += Win_CheckedUnChecked; columnChooser.Closing += Win_Closing; columnChooser.Show(); } else { columnChooser.Activate(); } }
private void Win_Closing(object sender, CancelEventArgs e) { columnChooser.CheckedUnChecked -= Win_CheckedUnChecked; columnChooser.Closing -= Win_Closing; columnChooser = null; }