private void self_Unloaded(object sender, RoutedEventArgs e) { // Detach from host. // Must check for null, unloaded event might be raised even if no loaded event has been raised before! FilterHost?.RemoveColumn(this); if (DataGrid != null) { DataGrid.SourceUpdated -= DataGrid_SourceOrTargetUpdated; DataGrid.TargetUpdated -= DataGrid_SourceOrTargetUpdated; DataGrid.RowEditEnding -= DataGrid_RowEditEnding; } // Clear all bindings generated during load. BindingOperations.ClearBinding(this, VisibilityProperty); BindingOperations.ClearBinding(this, TemplateProperty); BindingOperations.ClearBinding(this, FilterProperty); }
private void Self_Unloaded(object sender, RoutedEventArgs e) { if (FilterHost != null) { FilterHost.RemoveColumn(this); } if (DataGrid != null) { DataGrid.SourceUpdated -= DataGrid_SourceOrTargetUpdated; DataGrid.TargetUpdated -= DataGrid_SourceOrTargetUpdated; DataGrid.RowEditEnding -= DataGrid_RowEditEnding; } //BindingOperations.ClearBinding((DependencyObject)this, UIElement.VisibilityProperty); BindingOperations.ClearBinding(this, TemplateProperty); //BindingOperations.ClearBinding((DependencyObject)this, DataGridFilterColumnControl.FilterProperty); }
private void Self_Unloaded([NotNull] object sender, [NotNull] RoutedEventArgs e) { // Detach from host. // Must check for null, unloaded event might be raised even if no loaded event has been raised before! FilterHost?.RemoveColumn(this); var dataGrid = DataGrid; if (dataGrid != null) { dataGrid.SourceUpdated -= DataGrid_SourceOrTargetUpdated; dataGrid.TargetUpdated -= DataGrid_SourceOrTargetUpdated; dataGrid.RowEditEnding -= DataGrid_RowEditEnding; } // Clear all bindings generated during load. // ReSharper disable once AssignNullToNotNullAttribute BindingOperations.ClearBinding(this, VisibilityProperty); // ReSharper disable once AssignNullToNotNullAttribute BindingOperations.ClearBinding(this, TemplateProperty); BindingOperations.ClearBinding(this, FilterProperty); }