private void UserControl_Unloaded(object sender, RoutedEventArgs e) { // Explicitly remove references to allow the Win2D controls to get garbage collected if (_canvasControl != null) { _canvasControl.RemoveFromVisualTree(); _canvasControl = null; } }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { // Explicitly remove references to allow the Win2D controls to get garbage collected if (_canvasControl != null) { _canvasControl.RemoveFromVisualTree(); _canvasControl = null; } if (_bitmapCanvas != null) { _bitmapCanvas.Dispose(); _bitmapCanvas = null; } ClearComposition(); }