Skip to content

Commit 6879d03

Browse files
committed
Add OnDetachedFrom method to ContextActionBehavior
Implement OnDetachedFrom to clear ContextFlyout when detached from a View, ensuring no lingering context menus remain.
1 parent 7afe01b commit 6879d03

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/PJ.ContextActions.Maui/Controls/ContextActionBehavior.windows.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ protected override void OnAttachedTo(View bindable, FrameworkElement platformVie
1515
platformView.ContextFlyout = CreateMenu(bindable);
1616
}
1717

18+
protected override void OnDetachedFrom(View bindable, FrameworkElement platformView)
19+
{
20+
platformView.ContextFlyout = null;
21+
}
22+
1823
WMenuFlyout CreateMenu(View view)
1924
{
2025
var contextMenu = new WMenuFlyout();

0 commit comments

Comments
 (0)