diff --git a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt index 0616af2e2268..9440ba3acf61 100644 --- a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt @@ -105,4 +105,26 @@ override Microsoft.Maui.Controls.SearchBar.IsEnabledCore.get -> bool Microsoft.Maui.Controls.IValueConverter.Convert(object? value, System.Type! targetType, object? parameter, System.Globalization.CultureInfo! culture) -> object? Microsoft.Maui.Controls.IValueConverter.ConvertBack(object? value, System.Type! targetType, object? parameter, System.Globalization.CultureInfo! culture) -> object? ~static Microsoft.Maui.Controls.GridExtensions.Add(this Microsoft.Maui.Controls.Grid grid, Microsoft.Maui.IView view, int left, int right, int top, int bottom) -> void -~static Microsoft.Maui.Controls.GridExtensions.AddWithSpan(this Microsoft.Maui.Controls.Grid grid, Microsoft.Maui.IView view, int row = 0, int column = 0, int rowSpan = 1, int columnSpan = 1) -> void \ No newline at end of file +~static Microsoft.Maui.Controls.GridExtensions.AddWithSpan(this Microsoft.Maui.Controls.Grid grid, Microsoft.Maui.IView view, int row = 0, int column = 0, int rowSpan = 1, int columnSpan = 1) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(string! key, object! value) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(System.Collections.Generic.KeyValuePair item) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Clear() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Contains(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ContainsKey(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.CopyTo(System.Collections.Generic.KeyValuePair[]! array, int arrayIndex) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Count.get -> int +Microsoft.Maui.Controls.ShellNavigationQueryParameters.GetEnumerator() -> System.Collections.Generic.IEnumerator>! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.IsReadOnly.get -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IDictionary! dictionary) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IEnumerable>! collection) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].get -> object! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].set -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.TryGetValue(string! key, out object! value) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Values.get -> System.Collections.Generic.ICollection! +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, bool animate, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt index cee4b8a1b18c..f8f1f0acb145 100644 --- a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt @@ -108,3 +108,25 @@ Microsoft.Maui.Controls.IValueConverter.ConvertBack(object? value, System.Type! *REMOVED*override Microsoft.Maui.Controls.Handlers.Compatibility.PhoneFlyoutPageRenderer.WillRotate(UIKit.UIInterfaceOrientation toInterfaceOrientation, double duration) -> void ~virtual Microsoft.Maui.Controls.Handlers.Items.ItemsViewController.DetermineCellReuseId(Foundation.NSIndexPath indexPath) -> string override Microsoft.Maui.Controls.Handlers.Items.ItemsViewHandler.GetDesiredSize(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size +Microsoft.Maui.Controls.ShellNavigationQueryParameters +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(string! key, object! value) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(System.Collections.Generic.KeyValuePair item) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Clear() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Contains(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ContainsKey(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.CopyTo(System.Collections.Generic.KeyValuePair[]! array, int arrayIndex) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Count.get -> int +Microsoft.Maui.Controls.ShellNavigationQueryParameters.GetEnumerator() -> System.Collections.Generic.IEnumerator>! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.IsReadOnly.get -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IDictionary! dictionary) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IEnumerable>! collection) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].get -> object! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].set -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.TryGetValue(string! key, out object! value) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Values.get -> System.Collections.Generic.ICollection! +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, bool animate, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt index cee4b8a1b18c..f8f1f0acb145 100644 --- a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt @@ -108,3 +108,25 @@ Microsoft.Maui.Controls.IValueConverter.ConvertBack(object? value, System.Type! *REMOVED*override Microsoft.Maui.Controls.Handlers.Compatibility.PhoneFlyoutPageRenderer.WillRotate(UIKit.UIInterfaceOrientation toInterfaceOrientation, double duration) -> void ~virtual Microsoft.Maui.Controls.Handlers.Items.ItemsViewController.DetermineCellReuseId(Foundation.NSIndexPath indexPath) -> string override Microsoft.Maui.Controls.Handlers.Items.ItemsViewHandler.GetDesiredSize(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size +Microsoft.Maui.Controls.ShellNavigationQueryParameters +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(string! key, object! value) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(System.Collections.Generic.KeyValuePair item) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Clear() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Contains(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ContainsKey(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.CopyTo(System.Collections.Generic.KeyValuePair[]! array, int arrayIndex) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Count.get -> int +Microsoft.Maui.Controls.ShellNavigationQueryParameters.GetEnumerator() -> System.Collections.Generic.IEnumerator>! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.IsReadOnly.get -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IDictionary! dictionary) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IEnumerable>! collection) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].get -> object! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].set -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.TryGetValue(string! key, out object! value) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Values.get -> System.Collections.Generic.ICollection! +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, bool animate, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt index 372b793ed721..41e62a8610f3 100644 --- a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt @@ -90,4 +90,26 @@ Microsoft.Maui.Controls.Shapes.Shape.~Shape() -> void override Microsoft.Maui.Controls.Shapes.Shape.OnBindingContextChanged() -> void ~override Microsoft.Maui.Controls.ImageButton.OnPropertyChanged(string propertyName = null) -> void ~static Microsoft.Maui.Controls.Region.FromRectangles(System.Collections.Generic.IEnumerable rectangles) -> Microsoft.Maui.Controls.Region +Microsoft.Maui.Controls.ShellNavigationQueryParameters +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(string! key, object! value) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(System.Collections.Generic.KeyValuePair item) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Clear() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Contains(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ContainsKey(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.CopyTo(System.Collections.Generic.KeyValuePair[]! array, int arrayIndex) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Count.get -> int +Microsoft.Maui.Controls.ShellNavigationQueryParameters.GetEnumerator() -> System.Collections.Generic.IEnumerator>! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.IsReadOnly.get -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IDictionary! dictionary) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IEnumerable>! collection) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].get -> object! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].set -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.TryGetValue(string! key, out object! value) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Values.get -> System.Collections.Generic.ICollection! +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, bool animate, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task ~static readonly Microsoft.Maui.Controls.InputView.IsTextPredictionEnabledProperty -> Microsoft.Maui.Controls.BindableProperty diff --git a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt index e4fb9de02d08..c14625882eef 100644 --- a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt @@ -17,6 +17,7 @@ Microsoft.Maui.Controls.PointerGestureRecognizer.PointerMovedCommandParameter.ge *REMOVED*Microsoft.Maui.Controls.PointerGestureRecognizer.PointerExitedCommandParameter.get -> System.Windows.Input.ICommand! *REMOVED*Microsoft.Maui.Controls.PointerGestureRecognizer.PointerMovedCommandParameter.get -> System.Windows.Input.ICommand! Microsoft.Maui.Controls.Handlers.Items.StructuredItemsViewHandler.~StructuredItemsViewHandler() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.TryGetValue(string! key, out object! value) -> bool override Microsoft.Maui.Controls.Handlers.BoxViewHandler.NeedsContainer.get -> bool Microsoft.Maui.Controls.Handlers.BoxViewHandler Microsoft.Maui.Controls.Handlers.BoxViewHandler.BoxViewHandler() -> void @@ -105,4 +106,25 @@ override Microsoft.Maui.Controls.SearchBar.IsEnabledCore.get -> bool Microsoft.Maui.Controls.IValueConverter.Convert(object? value, System.Type! targetType, object? parameter, System.Globalization.CultureInfo! culture) -> object? Microsoft.Maui.Controls.IValueConverter.ConvertBack(object? value, System.Type! targetType, object? parameter, System.Globalization.CultureInfo! culture) -> object? ~static Microsoft.Maui.Controls.GridExtensions.Add(this Microsoft.Maui.Controls.Grid grid, Microsoft.Maui.IView view, int left, int right, int top, int bottom) -> void -~static Microsoft.Maui.Controls.GridExtensions.AddWithSpan(this Microsoft.Maui.Controls.Grid grid, Microsoft.Maui.IView view, int row = 0, int column = 0, int rowSpan = 1, int columnSpan = 1) -> void \ No newline at end of file +~static Microsoft.Maui.Controls.GridExtensions.AddWithSpan(this Microsoft.Maui.Controls.Grid grid, Microsoft.Maui.IView view, int row = 0, int column = 0, int rowSpan = 1, int columnSpan = 1) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(string! key, object! value) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(System.Collections.Generic.KeyValuePair item) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Clear() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Contains(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ContainsKey(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.CopyTo(System.Collections.Generic.KeyValuePair[]! array, int arrayIndex) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Count.get -> int +Microsoft.Maui.Controls.ShellNavigationQueryParameters.GetEnumerator() -> System.Collections.Generic.IEnumerator>! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.IsReadOnly.get -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IDictionary! dictionary) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IEnumerable>! collection) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].get -> object! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].set -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Values.get -> System.Collections.Generic.ICollection! +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, bool animate, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt index d45f74eb2f3f..0b86d15a5581 100644 --- a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt @@ -93,4 +93,26 @@ override Microsoft.Maui.Controls.SearchBar.IsEnabledCore.get -> bool Microsoft.Maui.Controls.IValueConverter.Convert(object? value, System.Type! targetType, object? parameter, System.Globalization.CultureInfo! culture) -> object? Microsoft.Maui.Controls.IValueConverter.ConvertBack(object? value, System.Type! targetType, object? parameter, System.Globalization.CultureInfo! culture) -> object? ~static Microsoft.Maui.Controls.GridExtensions.Add(this Microsoft.Maui.Controls.Grid grid, Microsoft.Maui.IView view, int left, int right, int top, int bottom) -> void -~static Microsoft.Maui.Controls.GridExtensions.AddWithSpan(this Microsoft.Maui.Controls.Grid grid, Microsoft.Maui.IView view, int row = 0, int column = 0, int rowSpan = 1, int columnSpan = 1) -> void \ No newline at end of file +~static Microsoft.Maui.Controls.GridExtensions.AddWithSpan(this Microsoft.Maui.Controls.Grid grid, Microsoft.Maui.IView view, int row = 0, int column = 0, int rowSpan = 1, int columnSpan = 1) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(string! key, object! value) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(System.Collections.Generic.KeyValuePair item) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Clear() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Contains(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ContainsKey(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.CopyTo(System.Collections.Generic.KeyValuePair[]! array, int arrayIndex) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Count.get -> int +Microsoft.Maui.Controls.ShellNavigationQueryParameters.GetEnumerator() -> System.Collections.Generic.IEnumerator>! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.IsReadOnly.get -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IDictionary! dictionary) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IEnumerable>! collection) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].get -> object! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].set -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.TryGetValue(string! key, out object! value) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Values.get -> System.Collections.Generic.ICollection! +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, bool animate, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt index 42db94feb726..4752cffc98ec 100644 --- a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt @@ -18,6 +18,26 @@ Microsoft.Maui.Controls.PointerGestureRecognizer.PointerMovedCommandParameter.ge Microsoft.Maui.Controls.Region.Equals(Microsoft.Maui.Controls.Region other) -> bool Microsoft.Maui.Controls.Shapes.Matrix.Equals(Microsoft.Maui.Controls.Shapes.Matrix other) -> bool Microsoft.Maui.Controls.Shapes.Shape.~Shape() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(string! key, object! value) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Add(System.Collections.Generic.KeyValuePair item) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Clear() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Contains(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ContainsKey(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.CopyTo(System.Collections.Generic.KeyValuePair[]! array, int arrayIndex) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Count.get -> int +Microsoft.Maui.Controls.ShellNavigationQueryParameters.GetEnumerator() -> System.Collections.Generic.IEnumerator>! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.IsReadOnly.get -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Keys.get -> System.Collections.Generic.ICollection! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(string! key) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Remove(System.Collections.Generic.KeyValuePair item) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters() -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IDictionary! dictionary) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.ShellNavigationQueryParameters(System.Collections.Generic.IEnumerable>! collection) -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].get -> object! +Microsoft.Maui.Controls.ShellNavigationQueryParameters.this[string! key].set -> void +Microsoft.Maui.Controls.ShellNavigationQueryParameters.TryGetValue(string! key, out object! value) -> bool +Microsoft.Maui.Controls.ShellNavigationQueryParameters.Values.get -> System.Collections.Generic.ICollection! Microsoft.Maui.Controls.VisualElement.~VisualElement() -> void override Microsoft.Maui.Controls.LayoutOptions.GetHashCode() -> int override Microsoft.Maui.Controls.Region.GetHashCode() -> int @@ -45,6 +65,8 @@ Microsoft.Maui.Controls.VisualElement.RefreshIsEnabledProperty() -> void override Microsoft.Maui.Controls.Button.IsEnabledCore.get -> bool override Microsoft.Maui.Controls.ImageButton.IsEnabledCore.get -> bool override Microsoft.Maui.Controls.SearchBar.IsEnabledCore.get -> bool +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, bool animate, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task +~Microsoft.Maui.Controls.Shell.GoToAsync(Microsoft.Maui.Controls.ShellNavigationState state, Microsoft.Maui.Controls.ShellNavigationQueryParameters shellNavigationQueryParameters) -> System.Threading.Tasks.Task ~Microsoft.Maui.Controls.WebView.UserAgent.get -> string ~Microsoft.Maui.Controls.WebView.UserAgent.set -> void ~override Microsoft.Maui.Controls.ImageButton.OnPropertyChanged(string propertyName = null) -> void diff --git a/src/Controls/src/Core/Shell/Shell.cs b/src/Controls/src/Core/Shell/Shell.cs index 8f6510bcbc60..1f3f93756796 100644 --- a/src/Controls/src/Core/Shell/Shell.cs +++ b/src/Controls/src/Core/Shell/Shell.cs @@ -691,6 +691,29 @@ public Task GoToAsync(ShellNavigationState state, bool animate, IDictionary + /// This method navigates to a and returns a that will complete once the navigation animation. + /// + /// Defines the path for Shell to navigate to. + /// Parameters to use for this specific navigation operation. + /// + public Task GoToAsync(ShellNavigationState state, ShellNavigationQueryParameters shellNavigationQueryParameters) + { + return _navigationManager.GoToAsync(state, null, false, parameters: new ShellRouteParameters(shellNavigationQueryParameters)); + } + + /// + /// This method navigates to a and returns a . + /// + /// Defines the path for Shell to navigate to. + /// Indicates if your transition is animated + /// Parameters to use for this specific navigation operation. + /// + public Task GoToAsync(ShellNavigationState state, bool animate, ShellNavigationQueryParameters shellNavigationQueryParameters) + { + return _navigationManager.GoToAsync(state, animate, false, parameters: new ShellRouteParameters(shellNavigationQueryParameters)); + } + public void AddLogicalChild(Element element) { if (element == null) diff --git a/src/Controls/src/Core/Shell/ShellContent.cs b/src/Controls/src/Core/Shell/ShellContent.cs index 9c3a465a682a..c0c06b8d0ef3 100644 --- a/src/Controls/src/Core/Shell/ShellContent.cs +++ b/src/Controls/src/Core/Shell/ShellContent.cs @@ -287,7 +287,10 @@ static void ApplyQueryAttributes(object content, ShellRouteParameters query, She oldQuery = oldQuery ?? new ShellRouteParameters(); if (content is IQueryAttributable attributable) - attributable.ApplyQueryAttributes(query); + { + attributable + .ApplyQueryAttributes(query.ToReadOnlyIfUsingShellNavigationQueryParameters()); + } if (content is BindableObject bindable && bindable.BindingContext != null && content != bindable.BindingContext) ApplyQueryAttributes(bindable.BindingContext, query, oldQuery); @@ -295,7 +298,10 @@ static void ApplyQueryAttributes(object content, ShellRouteParameters query, She var type = content.GetType(); var queryPropertyAttributes = type.GetCustomAttributes(typeof(QueryPropertyAttribute), true); if (queryPropertyAttributes.Length == 0) + { + ClearQueryIfAppliedToPage(query, content); return; + } foreach (QueryPropertyAttribute attrib in queryPropertyAttributes) { @@ -327,6 +333,16 @@ static void ApplyQueryAttributes(object content, ShellRouteParameters query, She prop.SetValue(content, null); } } + + ClearQueryIfAppliedToPage(query, content); + + static void ClearQueryIfAppliedToPage(ShellRouteParameters query, object content) + { + // Once we've applied the attributes to ContentPage lets remove the + // parameters used during navigation + if (content is ContentPage) + query.ResetToQueryParameters(); + } } } } diff --git a/src/Controls/src/Core/Shell/ShellNavigationManager.cs b/src/Controls/src/Core/Shell/ShellNavigationManager.cs index 986684000caa..9329bf1a5f11 100644 --- a/src/Controls/src/Core/Shell/ShellNavigationManager.cs +++ b/src/Controls/src/Core/Shell/ShellNavigationManager.cs @@ -92,8 +92,7 @@ internal async Task GoToAsync( var uri = navigationRequest.Request.FullUri; var queryString = navigationRequest.Query; - var queryData = ParseQueryString(queryString); - parameters.Merge(queryData); + parameters.SetQueryStringParameters(queryString); ApplyQueryAttributes(_shell, parameters, false, false); var shellItem = navigationRequest.Request.Item; @@ -306,17 +305,7 @@ public static void ApplyQueryAttributes(Element element, ShellRouteParameters qu baseShellItem = element?.Parent as BaseShellItem; //filter the query to only apply the keys with matching prefix - var filteredQuery = new ShellRouteParameters(query.Count); - - foreach (var q in query) - { - if (!q.Key.StartsWith(prefix, StringComparison.Ordinal)) - continue; - var key = q.Key.Substring(prefix.Length); - if (key.IndexOf(".", StringComparison.Ordinal) != -1) - continue; - filteredQuery.Add(key, q.Value); - } + var filteredQuery = new ShellRouteParameters(query, prefix); if (baseShellItem is ShellContent) @@ -488,24 +477,6 @@ public static ShellNavigationSource CalculateNavigationSource(Shell shell, Shell return ShellNavigationSource.Push; } - static Dictionary ParseQueryString(string query) - { - if (query.StartsWith("?", StringComparison.Ordinal)) - query = query.Substring(1); - Dictionary lookupDict = new(StringComparer.Ordinal); - if (query == null) - return lookupDict; - foreach (var part in query.Split('&')) - { - var p = part.Split('='); - if (p.Length != 2) - continue; - lookupDict[p[0]] = p[1]; - } - - return lookupDict; - } - public static ShellNavigationParameters GetNavigationParameters( ShellItem shellItem, ShellSection shellSection, diff --git a/src/Controls/src/Core/Shell/ShellNavigationQueryParameters.cs b/src/Controls/src/Core/Shell/ShellNavigationQueryParameters.cs new file mode 100644 index 000000000000..c71a6592474a --- /dev/null +++ b/src/Controls/src/Core/Shell/ShellNavigationQueryParameters.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.Maui.Controls +{ + public class ShellNavigationQueryParameters : IDictionary + { + Dictionary _internal = new Dictionary(); + bool _isReadonly; + + public ShellNavigationQueryParameters() + { + } + + public ShellNavigationQueryParameters(IEnumerable> collection) + { + foreach (var item in collection) + this.Add(item.Key, item.Value); + } + + public ShellNavigationQueryParameters(IDictionary dictionary) + { + foreach (var item in dictionary) + this.Add(item.Key, item.Value); + } + + internal ShellNavigationQueryParameters SetToReadOnly() + { + _isReadonly = true; + return this; + } + + void CheckReadOnlyState() + { + if (_isReadonly) + throw new InvalidOperationException($"ShellNavigationQueryParameters are ReadOnly"); + } + + public object this[string key] + { + get => _internal[key]; + set + { + CheckReadOnlyState(); + _internal[key] = value; + } + } + + public ICollection Keys => _internal.Keys; + + public ICollection Values => _internal.Values; + + public int Count => _internal.Count; + + public bool IsReadOnly => _isReadonly; + + public void Add(string key, object value) + { + CheckReadOnlyState(); + _internal.Add(key, value); + } + + public void Add(KeyValuePair item) + { + CheckReadOnlyState(); + _internal.Add(item.Key, item.Value); + } + + public void Clear() + { + CheckReadOnlyState(); + _internal.Clear(); + } + + public bool Contains(KeyValuePair item) => _internal.ContainsKey(item.Key); + + public bool ContainsKey(string key) => _internal.ContainsKey(key); + + public void CopyTo(KeyValuePair[] array, int arrayIndex) + => (_internal as ICollection>)?.CopyTo(array, arrayIndex); + + public IEnumerator> GetEnumerator() => _internal.GetEnumerator(); + + public bool Remove(string key) + { + CheckReadOnlyState(); + return _internal.Remove(key); + } + + public bool Remove(KeyValuePair item) + { + CheckReadOnlyState(); + return (_internal as ICollection>).Remove(item); + } + +#if NETSTANDARD2_1 || NETSTANDARD2_0 + public bool TryGetValue(string key, out object value) +#else + public bool TryGetValue(string key, [MaybeNullWhen(false)] out object value) +#endif + { + return _internal.TryGetValue(key, out value); + } + + IEnumerator IEnumerable.GetEnumerator() => + _internal.GetEnumerator(); + } +} \ No newline at end of file diff --git a/src/Controls/src/Core/Shell/ShellRouteParameters.cs b/src/Controls/src/Core/Shell/ShellRouteParameters.cs index 5b67497fc2a8..495f55b02ac3 100644 --- a/src/Controls/src/Core/Shell/ShellRouteParameters.cs +++ b/src/Controls/src/Core/Shell/ShellRouteParameters.cs @@ -1,5 +1,6 @@ #nullable disable using System; +using System.Collections; using System.Collections.Generic; using System.Text; @@ -7,33 +8,114 @@ namespace Microsoft.Maui.Controls { internal class ShellRouteParameters : Dictionary { + readonly ShellNavigationQueryParameters _shellNavigationQueryParameters = + new ShellNavigationQueryParameters(); + public ShellRouteParameters() { } public ShellRouteParameters(ShellRouteParameters shellRouteParams) : base(shellRouteParams) { + foreach (var item in shellRouteParams._shellNavigationQueryParameters) + _shellNavigationQueryParameters[item.Key] = item.Value; + } + + internal IDictionary ToReadOnlyIfUsingShellNavigationQueryParameters() + { + if (_shellNavigationQueryParameters.Count > 0) + { + var returnValue = new ShellNavigationQueryParameters(_shellNavigationQueryParameters); + + foreach (var item in this) + { + if (!returnValue.ContainsKey(item.Key)) + returnValue.Add(item.Key, item.Value); + } + + return returnValue.SetToReadOnly(); + } + + return this; + } + + internal ShellRouteParameters(ShellRouteParameters query, string prefix) + : base(query.Count) + { + foreach (var q in query) + { + if (!q.Key.StartsWith(prefix, StringComparison.Ordinal)) + continue; + var key = q.Key.Substring(prefix.Length); + if (key.IndexOf(".", StringComparison.Ordinal) != -1) + continue; + this.Add(key, q.Value); + } + + foreach (var item in query._shellNavigationQueryParameters) + _shellNavigationQueryParameters[item.Key] = item.Value; } - public ShellRouteParameters(IDictionary shellRouteParams) : base(shellRouteParams) + internal ShellRouteParameters(IDictionary shellRouteParams) : base(shellRouteParams) { } - public ShellRouteParameters(int count) - : base(count) + internal ShellRouteParameters(ShellNavigationQueryParameters shellNavigationQueryParameterss) { + foreach (var item in shellNavigationQueryParameterss) + this.Add(item.Key, item.Value); + + foreach (var item in shellNavigationQueryParameterss) + _shellNavigationQueryParameters[item.Key] = item.Value; } - internal void Merge(IDictionary input) + internal void ResetToQueryParameters() { - if (input == null || input.Count == 0) + if (_shellNavigationQueryParameters.Count == 0) return; - foreach (var item in input) - Add(item.Key, item.Value); + foreach (var item in _shellNavigationQueryParameters) + { + if (this.ContainsKey(item.Key)) + { + this.Remove(item.Key); + } + } + + _shellNavigationQueryParameters.Clear(); } - } + internal void SetQueryStringParameters(string query) + { + var queryStringParameters = ParseQueryString(query); + if (queryStringParameters == null || queryStringParameters.Count == 0) + return; + + foreach (var item in queryStringParameters) + { + if (!this.ContainsKey(item.Key)) + this[item.Key] = item.Value; + } + } + + static Dictionary ParseQueryString(string query) + { + if (query.StartsWith("?", StringComparison.Ordinal)) + query = query.Substring(1); + Dictionary lookupDict = new(StringComparer.Ordinal); + if (query == null) + return lookupDict; + foreach (var part in query.Split('&')) + { + var p = part.Split('='); + if (p.Length != 2) + continue; + lookupDict[p[0]] = p[1]; + } + + return lookupDict; + } + } internal static class ShellParameterExtensions { diff --git a/src/Controls/tests/Core.UnitTests/ShellParameterPassingTests.cs b/src/Controls/tests/Core.UnitTests/ShellParameterPassingTests.cs index 73978e3b78c8..0e2f31b61a09 100644 --- a/src/Controls/tests/Core.UnitTests/ShellParameterPassingTests.cs +++ b/src/Controls/tests/Core.UnitTests/ShellParameterPassingTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Xunit; @@ -150,7 +151,7 @@ public async Task NavigationBetweenShellContentsPassesQueryString() await shell.GoToAsync(new ShellNavigationState($"//content?{nameof(ShellTestPage.SomeQueryParameter)}=1234")); await shell.GoToAsync(new ShellNavigationState($"//section2/details?{nameof(ShellTestPage.SomeQueryParameter)}=4321")); - var testPage = (shell.CurrentItem.CurrentItem as IShellSectionController).PresentedPage as ShellTestPage; + var testPage = shell.CurrentPage as ShellTestPage; Assert.Equal("4321", testPage.SomeQueryParameter); } @@ -200,7 +201,7 @@ public async Task NavigationBetweenFlyoutItemWithPushedPageRetainsQueryString() await shellController.OnFlyoutItemSelectedAsync(flyoutItem1); await shellController.OnFlyoutItemSelectedAsync(flyoutItem2); - var testPage = (shell.CurrentItem.CurrentItem as IShellSectionController).PresentedPage as ShellTestPage; + var testPage = shell.CurrentPage as ShellTestPage; Assert.Equal("1234", testPage.SomeQueryParameter); } @@ -213,7 +214,7 @@ public async Task BasicQueryStringTest() Routing.RegisterRoute("details", typeof(ShellTestPage)); shell.Items.Add(item); await shell.GoToAsync(new ShellNavigationState($"details?{nameof(ShellTestPage.SomeQueryParameter)}=1234")); - var testPage = (shell.CurrentItem.CurrentItem as IShellSectionController).PresentedPage as ShellTestPage; + var testPage = shell.CurrentPage as ShellTestPage; Assert.Equal("1234", testPage.SomeQueryParameter); } @@ -290,7 +291,7 @@ public async Task SetParameterOfTypeThatsNotAString() Routing.RegisterRoute("details", typeof(ShellTestPage)); shell.Items.Add(item); await shell.GoToAsync(new ShellNavigationState($"details?{nameof(ShellTestPage.DoubleQueryParameter)}=1234")); - var testPage = (shell.CurrentItem.CurrentItem as IShellSectionController).PresentedPage as ShellTestPage; + var testPage = shell.CurrentPage as ShellTestPage; Assert.Equal(1234d, testPage.DoubleQueryParameter); } @@ -370,12 +371,150 @@ public async Task BasicShellParameterTest() }; await shell.GoToAsync(new ShellNavigationState($"details?{nameof(ShellTestPage.SomeQueryParameter)}=1234"), parameter); - var testPage = (shell.CurrentItem.CurrentItem as IShellSectionController).PresentedPage as ShellTestPage; + var testPage = shell.CurrentPage as ShellTestPage; Assert.Equal("1234", testPage.SomeQueryParameter); Assert.Equal(2d, testPage.DoubleQueryParameter); Assert.Equal(obj, testPage.ComplexObject); } + [Fact] + public async Task ValidateReadOnlyDictionary() + { + var obj = new object(); + var parameter = new ShellNavigationQueryParameters + { + {"DoubleQueryParameter", 2d }, + { "ComplexObject", obj} + }.SetToReadOnly(); + + Assert.Throws(() => parameter.Add("key", "value")); + Assert.Throws(() => parameter.Add(new KeyValuePair("key", "value"))); + Assert.Throws(() => parameter.Remove(parameter.First())); + Assert.Throws(() => parameter.Remove("DoubleQueryParameter")); + Assert.Throws(() => parameter["key"] = "value"); + Assert.Throws(() => parameter.Clear()); + } + + [Fact] + public async Task ShellNavigationQueryParametersPassedInAsReadOnly() + { + var shell = new Shell(); + var item = CreateShellItem(shellSectionRoute: "section2"); + Routing.RegisterRoute("details", typeof(ShellTestPage)); + shell.Items.Add(item); + var obj = new object(); + var parameter = new ShellNavigationQueryParameters + { + {"DoubleQueryParameter", 2d }, + { "ComplexObject", obj} + }; + + await shell.GoToAsync(new ShellNavigationState($"details"), parameter); + var testPage = shell.CurrentPage as ShellTestPage; + Assert.True(testPage.AppliedQueryAttributes[0].IsReadOnly); + Assert.False(parameter.IsReadOnly); + Assert.Single(testPage.AppliedQueryAttributes); + } + + [Fact] + public async Task ExtraParametersDontGetRetained() + { + var shell = new Shell(); + var item = CreateShellItem(shellSectionRoute: "section2"); + Routing.RegisterRoute("details", typeof(ShellTestPage)); + shell.Items.Add(item); + var obj = new object(); + var parameter = new ShellNavigationQueryParameters + { + {"DoubleQueryParameter", 2d }, + {"ComplexObject", obj} + }; + + await shell.GoToAsync(new ShellNavigationState($"details?{nameof(ShellTestPage.SomeQueryParameter)}=1234"), parameter); + var testPage = shell.CurrentPage as ShellTestPage; + + await shell.Navigation.PushAsync(new ContentPage()); + + testPage.SomeQueryParameter = String.Empty; + testPage.DoubleQueryParameter = -1d; + testPage.ComplexObject = null; + + await shell.GoToAsync(".."); + + Assert.Equal("1234", testPage.SomeQueryParameter); + Assert.Equal(-1d, testPage.DoubleQueryParameter); + Assert.Null(testPage.ComplexObject); + + // ensure that AppliedQueryAttributes is called with correct parameters each time + Assert.Equal(2, testPage.AppliedQueryAttributes.Count); + Assert.Equal(3, testPage.AppliedQueryAttributes[0].Count); + Assert.Equal(1, testPage.AppliedQueryAttributes[1].Count); + Assert.Equal($"{nameof(ShellTestPage.SomeQueryParameter)}", testPage.AppliedQueryAttributes[1].Keys.First()); + } + + [Fact] + public async Task ExtraParametersArentReAppliedWhenNavigatingBackToShellContent() + { + var shell = new Shell(); + var item = CreateShellItem(shellContentRoute: "start"); + var withParams = CreateShellItem(page: new ShellTestPage(), shellContentRoute: "withParams", templated: true); + shell.Items.Add(item); + shell.Items.Add(withParams); + var obj = new object(); + var parameter = new ShellRouteParameters + { + { "ComplexObject", obj}, + { nameof(ShellTestPage.SomeQueryParameter), "1234"} + }; + + await shell.GoToAsync(new ShellNavigationState($"//start")); + await shell.GoToAsync(new ShellNavigationState($"//withParams"), parameter); + + var testPage = (shell.CurrentItem.CurrentItem.CurrentItem as IShellContentController).GetOrCreateContent() as ShellTestPage; + + // Validate parameter was set during first navigation + Assert.Equal(obj, testPage.ComplexObject); + + // Clear parameters + testPage.ComplexObject = null; + testPage.SomeQueryParameter = null; + + // Navigate away and back to page with params + await shell.GoToAsync(new ShellNavigationState($"//start")); + shell.CurrentItem = withParams; + await Task.Yield(); + + var testPage2 = shell.CurrentPage as ShellTestPage; + Assert.Null(testPage2.SomeQueryParameter); + Assert.Null(testPage2.ComplexObject); + Assert.Equal(testPage2, testPage); + } + + [Fact] + public async Task SingleUseQueryParametersReplaceQueryStringParams() + { + var shell = new Shell(); + var item = CreateShellItem(shellSectionRoute: "section2"); + Routing.RegisterRoute("details", typeof(ShellTestPage)); + shell.Items.Add(item); + + var parameter = new ShellNavigationQueryParameters() + { + {nameof(ShellTestPage.SomeQueryParameter), "4321" } + }; + + await shell.GoToAsync(new ShellNavigationState($"details?{nameof(ShellTestPage.SomeQueryParameter)}=1234"), parameter); + var testPage = shell.CurrentPage as ShellTestPage; + + // Parameters passed in will win + Assert.Equal("4321", testPage.SomeQueryParameter); + await shell.Navigation.PushAsync(new ContentPage()); + testPage.SomeQueryParameter = "TheseDontGetSetAgain"; + await shell.GoToAsync(".."); + + Assert.Equal("TheseDontGetSetAgain", testPage.SomeQueryParameter); + } + [Fact] public async Task DotDotNavigationPassesShellParameters() { diff --git a/src/Controls/tests/Core.UnitTests/ShellTestBase.cs b/src/Controls/tests/Core.UnitTests/ShellTestBase.cs index a21c6d557ce4..624fcc1d3ff6 100644 --- a/src/Controls/tests/Core.UnitTests/ShellTestBase.cs +++ b/src/Controls/tests/Core.UnitTests/ShellTestBase.cs @@ -88,7 +88,7 @@ protected ShellSection MakeSimpleShellSection(string route, string contentRoute, [QueryProperty("SomeQueryParameter", "SomeQueryParameter")] [QueryProperty("CancelNavigationOnBackButtonPressed", "CancelNavigationOnBackButtonPressed")] [QueryProperty("ComplexObject", "ComplexObject")] - public class ShellTestPage : ContentPage + public class ShellTestPage : ContentPage, IQueryAttributable { public string CancelNavigationOnBackButtonPressed { get; set; } public ShellTestPage() @@ -128,6 +128,15 @@ protected override bool OnBackButtonPressed() return base.OnBackButtonPressed(); } + + public List> AppliedQueryAttributes = new List>(); + public void ApplyQueryAttributes(IDictionary query) + { + if (query is ShellNavigationQueryParameters param && param.IsReadOnly) + AppliedQueryAttributes.Add(query); + else + AppliedQueryAttributes.Add(new Dictionary(query)); + } } protected ShellItem CreateShellItem(