diff --git a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs index 0c8e50b35d..bf6bf1974e 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs @@ -275,7 +275,7 @@ private async void StopEditTransaction(object sender, EventArgs e) try { // Ask the user if they want to commit or rollback the transaction (or cancel to keep working in the transaction). - string choice = await DisplayActionSheet("Transaction", "Cancel", null, "Commit", "Rollback"); + string choice = await Application.Current.Windows[0].Page.DisplayActionSheet("Transaction", "Cancel", null, "Commit", "Rollback"); if (choice == "Commit") { diff --git a/src/MAUI/Maui.Samples/Samples/Layers/RasterRenderingRule/RasterRenderingRule.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/RasterRenderingRule/RasterRenderingRule.xaml.cs index bf0675623e..a3b69ae177 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/RasterRenderingRule/RasterRenderingRule.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/RasterRenderingRule/RasterRenderingRule.xaml.cs @@ -95,7 +95,7 @@ private async Task ChangeRenderingRuleAsync() try { // Display a picker to the user to choose among the available rendering rules for the image service raster - string myRenderingRuleInfoName = await DisplayActionSheet("Select a Rendering Rule", "Cancel", null, _names.ToArray()); + string myRenderingRuleInfoName = await Application.Current.Windows[0].Page.DisplayActionSheet("Select a Rendering Rule", "Cancel", null, _names.ToArray()); // Loop through each rendering rule info in the image service raster foreach (RenderingRuleInfo myRenderingRuleInfo in _myReadOnlyListRenderRuleInfos) diff --git a/src/MAUI/Maui.Samples/Samples/Map/AuthorMap/AuthorMap.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/AuthorMap/AuthorMap.xaml.cs index 3bd95c2851..3e4a41480c 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/AuthorMap/AuthorMap.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/AuthorMap/AuthorMap.xaml.cs @@ -162,7 +162,7 @@ private async void Basemap_Clicked(object sender, EventArgs e) { try { - string selectionName = await DisplayActionSheet("Select basemap", "Cancel", null, _basemaps.Keys.ToArray()); + string selectionName = await Application.Current.Windows[0].Page.DisplayActionSheet("Select basemap", "Cancel", null, _basemaps.Keys.ToArray()); if (selectionName == "Cancel") return; @@ -181,7 +181,7 @@ private async void Add_Clicked(object sender, EventArgs e) { string[] inMapNames = MyMapView.Map.OperationalLayers.Select(l => l.Name).ToArray(); string[] optionNames = _operationalLayerUrls.Where(l => !inMapNames.Contains(l.Key)).Select(l => l.Key).ToArray(); - string selectionName = await DisplayActionSheet("Select layer to add", "Cancel", null, optionNames); + string selectionName = await Application.Current.Windows[0].Page.DisplayActionSheet("Select layer to add", "Cancel", null, optionNames); if (selectionName == "Cancel") return; @@ -204,7 +204,7 @@ private async void Remove_Clicked(object sender, EventArgs e) { try { - string selectionName = await DisplayActionSheet("Select layer to remove", "Cancel", null, MyMapView.Map.OperationalLayers.Select(l => l.Name).ToArray()); + string selectionName = await Application.Current.Windows[0].Page.DisplayActionSheet("Select layer to remove", "Cancel", null, MyMapView.Map.OperationalLayers.Select(l => l.Name).ToArray()); if (selectionName == "Cancel") return; diff --git a/src/MAUI/Maui.Samples/Samples/Map/OpenMapURL/OpenMapURL.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/OpenMapURL/OpenMapURL.xaml.cs index 91330ee743..703b236a44 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/OpenMapURL/OpenMapURL.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/OpenMapURL/OpenMapURL.xaml.cs @@ -48,7 +48,7 @@ private async void OnMapsClicked(object sender, EventArgs e) try { // Show sheet and get title from the selection - string selectedMapTitle = await DisplayActionSheet("Select map", "Cancel", null, _titles); + string selectedMapTitle = await Application.Current.Windows[0].Page.DisplayActionSheet("Select map", "Cancel", null, _titles); // If selected cancel do nothing if (selectedMapTitle == null || selectedMapTitle == "Cancel") return; diff --git a/src/MAUI/Maui.Samples/Samples/MapView/ChangeViewpoint/ChangeViewpoint.xaml.cs b/src/MAUI/Maui.Samples/Samples/MapView/ChangeViewpoint/ChangeViewpoint.xaml.cs index 286d8e678d..f7015b0e15 100644 --- a/src/MAUI/Maui.Samples/Samples/MapView/ChangeViewpoint/ChangeViewpoint.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/MapView/ChangeViewpoint/ChangeViewpoint.xaml.cs @@ -76,7 +76,7 @@ private async void OnViewpointsClicked(object sender, EventArgs e) { // Show sheet and get title from the selection string selectedMapTitle = - await DisplayActionSheet("Select viewpoint", "Cancel", null, titles); + await Application.Current.Windows[0].Page.DisplayActionSheet("Select viewpoint", "Cancel", null, titles); // If selected cancel do nothing if (selectedMapTitle == "Cancel") return; diff --git a/src/MAUI/Maui.Samples/Samples/SceneView/ChooseCameraController/ChooseCameraController.xaml.cs b/src/MAUI/Maui.Samples/Samples/SceneView/ChooseCameraController/ChooseCameraController.xaml.cs index 552a9d670b..2f28e4df3f 100644 --- a/src/MAUI/Maui.Samples/Samples/SceneView/ChooseCameraController/ChooseCameraController.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/SceneView/ChooseCameraController/ChooseCameraController.xaml.cs @@ -135,7 +135,7 @@ private async void OnButtonClicked(object sender, EventArgs e) { // Show sheet and get the camera controller from the selection. string selectedCamera = - await DisplayActionSheet("Select camera controller", "Cancel", null, _controllers); + await Application.Current.Windows[0].Page.DisplayActionSheet("Select camera controller", "Cancel", null, _controllers); // If selected cancel then do nothing. if (selectedCamera == "Cancel") return; diff --git a/src/MAUI/Maui.Samples/Samples/Search/FindAddress/FindAddress.xaml.cs b/src/MAUI/Maui.Samples/Samples/Search/FindAddress/FindAddress.xaml.cs index 98b823bca0..7749357587 100644 --- a/src/MAUI/Maui.Samples/Samples/Search/FindAddress/FindAddress.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Search/FindAddress/FindAddress.xaml.cs @@ -152,7 +152,7 @@ private async void SuggestionButtonTapped(object sender, System.EventArgs e) try { // Display the list of suggestions; returns the selected option - string action = await DisplayActionSheet("Choose an address to geocode", "Cancel", null, _addresses); + string action = await Application.Current.Windows[0].Page.DisplayActionSheet("Choose an address to geocode", "Cancel", null, _addresses); if (action == "Cancel") { diff --git a/src/MAUI/Maui.Samples/Samples/Search/OfflineGeocode/OfflineGeocode.xaml.cs b/src/MAUI/Maui.Samples/Samples/Search/OfflineGeocode/OfflineGeocode.xaml.cs index d99c93eafe..180f0196f7 100644 --- a/src/MAUI/Maui.Samples/Samples/Search/OfflineGeocode/OfflineGeocode.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Search/OfflineGeocode/OfflineGeocode.xaml.cs @@ -163,7 +163,7 @@ private async void SuggestionButtonTapped(object sender, System.EventArgs e) try { // Display the list of suggestions; returns the selected option - string action = await DisplayActionSheet("Choose an address to geocode", "Cancel", null, _addresses); + string action = await Application.Current.Windows[0].Page.DisplayActionSheet("Choose an address to geocode", "Cancel", null, _addresses); // Update the search MySearchBar.Text = action; _ = UpdateSearchAsync(); diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/PerformValveIsolationTrace/PerformValveIsolationTrace.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/PerformValveIsolationTrace/PerformValveIsolationTrace.xaml.cs index 5cab8330f8..6c068bf3e8 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/PerformValveIsolationTrace/PerformValveIsolationTrace.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/PerformValveIsolationTrace/PerformValveIsolationTrace.xaml.cs @@ -209,7 +209,7 @@ private async Task GetTerminalAsync(IEnumerable x.Name).ToArray(); - string choice = await DisplayActionSheet("Choose junction.", "Cancel", null, terminalArray); + string choice = await Application.Current.Windows[0].Page.DisplayActionSheet("Choose junction.", "Cancel", null, terminalArray); if (terminalArray.Contains(choice)) { return terminals.Single(x => x.Name == choice); diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/TraceUtilityNetwork/TraceUtilityNetwork.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/TraceUtilityNetwork/TraceUtilityNetwork.xaml.cs index 3762f2a9ae..038b18f71c 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/TraceUtilityNetwork/TraceUtilityNetwork.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/TraceUtilityNetwork/TraceUtilityNetwork.xaml.cs @@ -222,7 +222,7 @@ private async Task WaitForTerminal(IEnumerable { // Load the terminals into a DisplayActionSheet and await the user's selection. var terminalArray = terminals.Select(x => x.Name).ToArray(); - string choice = await DisplayActionSheet("Choose junction.", "Cancel", null, terminalArray); + string choice = await Application.Current.Windows[0].Page.DisplayActionSheet("Choose junction.", "Cancel", null, terminalArray); if (terminalArray.Contains(choice)) { return terminals.Single(x => x.Name == choice); @@ -314,7 +314,7 @@ private async void TraceTypeButtonPressed(object sender, EventArgs e) { // Prompt the user to select a type of trace. var traceTypes = new string[] { "Connected", "Subnetwork", "Upstream", "Downstream" }; - string choice = await DisplayActionSheet("Choose type of trace", "Cancel", null, traceTypes); + string choice = await Application.Current.Windows[0].Page.DisplayActionSheet("Choose type of trace", "Cancel", null, traceTypes); // Set the selected trace type. _selectedTraceType = (UtilityTraceType)Enum.Parse(typeof(UtilityTraceType), choice); diff --git a/src/MAUI/Maui.Samples/Views/SamplePage.xaml.cs b/src/MAUI/Maui.Samples/Views/SamplePage.xaml.cs index 08c3bfeced..a5e2ccb8b1 100644 --- a/src/MAUI/Maui.Samples/Views/SamplePage.xaml.cs +++ b/src/MAUI/Maui.Samples/Views/SamplePage.xaml.cs @@ -418,7 +418,7 @@ private ToolbarItem PrepareScreenshotTool() private async void VerticalHandle_Clicked(object sender, EventArgs e) { - await DisplayActionSheet("", "Cancel", null, [LiveSample, Description, SourceCode, ViewOnGitHub, BugReport, FeatureRequest]).ContinueWith((result) => + await Application.Current.Windows[0].Page.DisplayActionSheet("", "Cancel", null, [LiveSample, Description, SourceCode, ViewOnGitHub, BugReport, FeatureRequest]).ContinueWith((result) => { if (result.Result != "Cancel") {