Click or drag to resize
ICanvasAnimatedControlRemoveFromVisualTree 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: 0.0.0.0
Syntax
C#
void RemoveFromVisualTree()
Remarks

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.

Examples
void page_Unloaded(object sender, RoutedEventArgs e)
{
    this.canvas.RemoveFromVisualTree();
    this.canvas = null;
}
See Also