|
14 | 14 | using Microsoft.Xaml.Interactivity; |
15 | 15 | using TriggerBase = Microsoft.Xaml.Interactivity.IBehavior; |
16 | 16 | using EventTrigger = Microsoft.Xaml.Interactions.Core.EventTriggerBehavior; |
| 17 | + using popupUI = Windows.UI.Xaml.Controls.Primitives; |
17 | 18 | #elif AVALONIA |
18 | 19 | using Avalonia; |
19 | 20 | using Avalonia.Data; |
|
30 | 31 | using EventTrigger = Avalonia.Xaml.Interactions.Core.EventTriggerBehavior; |
31 | 32 | using FrameworkElement = Avalonia.Controls.Control; |
32 | 33 | using Avalonia.Input; |
| 34 | + using popupUI = Avalonia.Controls.Primitives; |
33 | 35 | #elif WinUI3 |
34 | 36 | using Microsoft.UI.Xaml; |
35 | 37 | using Microsoft.UI.Xaml.Data; |
|
40 | 42 | using Microsoft.Xaml.Interactivity; |
41 | 43 | using TriggerBase = Microsoft.Xaml.Interactivity.IBehavior; |
42 | 44 | using EventTrigger = Microsoft.Xaml.Interactions.Core.EventTriggerBehavior; |
| 45 | + using popupUI = Microsoft.UI.Xaml.Controls.Primitives; |
43 | 46 | #else |
44 | 47 | using System.Windows; |
45 | 48 | using System.Windows.Controls.Primitives; |
46 | 49 | using System.Windows.Data; |
47 | 50 | using System.Windows.Markup; |
48 | 51 | using Microsoft.Xaml.Behaviors; |
49 | 52 | using EventTrigger = Microsoft.Xaml.Behaviors.EventTrigger; |
| 53 | + using popupUI = System.Windows.Controls.Primitives; |
50 | 54 | #endif |
51 | 55 |
|
52 | 56 | #if NET5_0_WINDOWS || NET6_0_WINDOWS |
@@ -597,16 +601,20 @@ public override string ToString() |
597 | 601 | } |
598 | 602 | } |
599 | 603 |
|
600 | | - //currentElement = BindingScope.GetVisualParent(currentElement); |
601 | 604 | var pElement = BindingScope.GetVisualParent(currentElement); |
602 | | - if(pElemenet != null && currentElement.GetType().Name.Equals("PopupRoot", StringComparison.OrdinalIgnoreCase)) |
| 605 | + if (pElement != null && currentElement.GetType().Name.Equals("PopupRoot", StringComparison.OrdinalIgnoreCase)) |
603 | 606 | { |
604 | | - if(currentElement is PopupRoot popupRoot && popupRoot.Parent is Popup popup) |
605 | | - { |
606 | | - pElement = popup.PlacementTarget; |
607 | | - } |
| 607 | + if (currentElement is popupUI.Popup popupRoot && popupRoot.Parent is popupUI.Popup popup) |
| 608 | + { |
| 609 | +#if WINDOWS_UWP |
| 610 | + pElement = popup.Parent; |
| 611 | +#else |
| 612 | + pElement = popup.PlacementTarget; |
| 613 | +#endif |
| 614 | + } |
608 | 615 | } |
609 | 616 | currentElement = pElement; |
| 617 | + |
610 | 618 | } |
611 | 619 | #if AVALONIA |
612 | 620 | Log.Info("SetMethodBinding avalonia"); |
|
0 commit comments