We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2abc65c commit 972bd09Copy full SHA for 972bd09
AIDevGallery/Controls/HomePage/Header/Lights/HoverLight.cs
@@ -92,6 +92,10 @@ private void TargetElement_PointerExited(object sender, PointerRoutedEventArgs e
92
93
protected override void OnDisconnected(UIElement oldElement)
94
{
95
+ // Unsubscribe event handlers to avoid retaining references and leaking the light or target element
96
+ oldElement.PointerMoved -= TargetElement_PointerMoved;
97
+ oldElement.PointerExited -= TargetElement_PointerExited;
98
+
99
// Dispose Light and Composition resources when it is removed from the tree
100
RemoveTargetElement(GetId(), oldElement);
101
CompositionLight.Dispose();
@@ -104,4 +108,4 @@ protected override string GetId()
104
108
105
109
return Id;
106
110
}
107
-}
111
+}
0 commit comments