CanvasVirtualControlRemoveFromVisualTree Method |
Namespace: Microsoft.Graphics.Canvas.UI.Xaml
public void RemoveFromVisualTree()
When using this control from managed code it is necessary to ensure that all references to it are released, otherwise it will not get garbage collected correctly. To do this, call RemoveFromVisualTree from the Unloaded event handler of the page that the control was on and then release any explicit references to it.
For more information, see Avoiding memory leaks.
void page_Unloaded(object sender, RoutedEventArgs e) { this.canvas.RemoveFromVisualTree(); this.canvas = null; }