Click or drag to resize
CanvasAnimatedControlRemoveFromVisualTree Method
Removes the control from the last FrameworkElement it was parented to.

Namespace:  Microsoft.Graphics.Canvas.UI.Xaml
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version:

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 = null;
See Also