Skip to content

Latest commit

 

History

History
28 lines (17 loc) · 1.45 KB

uielement_ondisconnectvisualchildren_1726180609.md

File metadata and controls

28 lines (17 loc) · 1.45 KB
-api-id -api-type
M:Microsoft.UI.Xaml.UIElement.OnDisconnectVisualChildren
winrt method

Microsoft.UI.Xaml.UIElement.OnDisconnectVisualChildren

-description

Override this method to implement how layout and logic should behave when items are removed from a class-specific content or children property.

-remarks

UIElement does not define any of the content model properties that OnDisconnectVisualChildren might act upon. Such properties are introduced deeper in an inheritance, for example at the ContentControl level.

FrameworkElement uses an OnDisconnectVisualChildren override to clear values from DataContext and Tag. In general, if you override this method you should always call the base implementation so that the framework-intentional behavior that acts on OnDisconnectVisualChildren can be preserved.

VisualTreeHelper.DisconnectChildrenRecursive is a similar static helper API that can be called by app code.

-examples

-see-also

VisualTreeHelper, VisualTreeHelper.DisconnectChildrenRecursive