Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/Controls/samples/Controls.Sample.UITests/Issues/Issue14829.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;

namespace Maui.Controls.Sample.Issues
{
[Issue(IssueTracker.Github, 14829, "DisplayActionSheet still not working on Windows", PlatformAffected.UWP)]
public class Issue14829 : TestContentPage
{
protected override void Init()
{
var navPage = new NavigationPage(new MainPage());
NavigatedTo += Issue14829_NavigatedTo;

async void Issue14829_NavigatedTo(object sender, NavigatedToEventArgs e)
{
NavigatedTo -= Issue14829_NavigatedTo;

await Navigation.PushModalAsync(navPage);
}
}

public partial class MainPage : ContentPage
{
protected override void OnAppearing()
{
Content = new VerticalStackLayout()
{
new Button()
{
AutomationId = "DisplayActionSheetButton",
Command = new Command(async () =>
{
await DisplayActionSheet("ActionSheet: Send to?", "Cancel", null, "Email", "Twitter", "Facebook");
}),
Text = "Click to Display Action Sheet"
}
};
Content.BackgroundColor = Colors.White;

base.OnAppearing();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public ActionSheetContent(ActionSheetArguments sheetOptions)
_options = sheetOptions;

TitleBlock.Text = _options.Title ?? string.Empty;
TitleBlock.SetAutomationPropertiesAutomationId("ActionSheetTitle");

OptionsList.ItemsSource = _options.Buttons.ToList();

if (_options.FlowDirection == Maui.FlowDirection.RightToLeft)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void OnActionSheetRequested(Page sender, ActionSheetArguments arguments)

try
{
var current = sender.ToPlatform(VirtualView.RequireMauiContext());
var current = sender.ToPlatform();
var pageParent = current?.Parent as FrameworkElement;

if (pageParent != null)
Expand Down Expand Up @@ -252,4 +252,4 @@ bool PageIsInThisWindow(Page page) =>
page?.Window == VirtualView;
}
}
}
}
27 changes: 27 additions & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue14829.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.AppiumTests.Issues
{
public class Issue14829 : _IssuesUITest
{
public Issue14829(TestDevice device) : base(device)
{
}

public override string Issue => "DisplayActionSheet still not working on Windows";

[Test]
[Category(UITestCategories.ActionSheet)]
public void Issue14829Test()
{
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.iOS }, "Only affects Windows.");

App.WaitForElement("DisplayActionSheetButton", timeout: TimeSpan.FromSeconds(4)).Click();
App.WaitForElement("ActionSheetTitle", timeout: TimeSpan.FromSeconds(4));

VerifyScreenshot();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.