示例#1
0
 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;
     }
 }
示例#2
0
        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();
        }