Skip to content

Commit

Permalink
fix: AppBar and Flyout base fixes for Uno Islands
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Apr 5, 2023
1 parent 886bc6d commit 5b0ca83
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ public void Should_Not_Close_Open_ContentDialogs()
[RunsOnUIThread]
public async Task When_Cancel_Then_CloseDialog()
{
if (WindowHelper.IsXamlIsland)
{
// MessageDialog is not supported in Uno Islands.
return;
}

var messageDialog = new MessageDialog("When_Cancel_Then_CloseDialog");
var asyncOperation = messageDialog.ShowAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public class Given_ApplicationView
[TestMethod]
public void When_StartupTitle_Is_Defined()
{
if (TestServices.WindowHelper.IsXamlIsland)
{
return;
}

Assert.AreEqual(Windows.ApplicationModel.Package.Current.DisplayName, StartupTitle);
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public async Task TestCalendarPanelSize()

var root = (Grid)SUT.FindName("Root");
var flyout = (Flyout)FlyoutBase.GetAttachedFlyout(root);
flyout.XamlRoot = SUT.XamlRoot;
flyout.Open();

await WindowHelper.WaitForIdle();
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Controls/AppBar/AppBar.Partial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ protected bool GetShouldOpenUp()

if (WinUICoreServices.Instance.InitializationType == InitializationType.IslandsOnly)
{
layoutBounds = XamlRoot!.Bounds;
layoutBounds = XamlRoot?.Bounds ?? new();
}

shouldOpenUp = offsetFromRootOpenedUp.Y >= layoutBounds.Y;
Expand Down
5 changes: 5 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/Flyout/FlyoutBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ protected internal virtual void Open()
SetPopupPosition(Target, PopupPositionInTarget);
ApplyTargetPosition();

if (XamlRoot is not null && _popup.XamlRoot is null)
{
_popup.XamlRoot = XamlRoot;
}

_popup.IsOpen = true;
}

Expand Down

0 comments on commit 5b0ca83

Please sign in to comment.