Skip to content

Commit faee39c

Browse files
committed
Improve visual parent retrieval in ActionMessage
Refactor visual parent retrieval logic for PopupRoot handling.
1 parent b9009a3 commit faee39c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Caliburn.Micro.Platform/ActionMessage.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,16 @@ public override string ToString()
597597
}
598598
}
599599

600-
currentElement = BindingScope.GetVisualParent(currentElement);
600+
//currentElement = BindingScope.GetVisualParent(currentElement);
601+
var pElement = BindingScope.GetVisualParent(currentElement);
602+
if(pElemenet != null && currentElement.GetType().Name.Equals("PopupRoot", StringComparison.OrdinalIgnoreCase))
603+
{
604+
If(currentElement is PopupRoot popupRoot && popupRoot.Parent is Popup popup)
605+
{
606+
pElement = popup.PlacementTarget;
607+
}
608+
}
609+
currentElement = pElement;
601610
}
602611
#if AVALONIA
603612
Log.Info("SetMethodBinding avalonia");

0 commit comments

Comments
 (0)