diff --git a/src/Controls/src/Core/Internals/PropertyPropagationExtensions.cs b/src/Controls/src/Core/Internals/PropertyPropagationExtensions.cs index 2c649015b880..a6ef8ef550c8 100644 --- a/src/Controls/src/Core/Internals/PropertyPropagationExtensions.cs +++ b/src/Controls/src/Core/Internals/PropertyPropagationExtensions.cs @@ -1,12 +1,14 @@ #nullable disable using System.Collections; +using System.Collections.Generic; +using System.Linq; namespace Microsoft.Maui.Controls.Internals { /// public static class PropertyPropagationExtensions { - internal static void PropagatePropertyChanged(string propertyName, Element element, IEnumerable children) + internal static void PropagatePropertyChanged(string propertyName, Element element, IReadOnlyList children) { if (propertyName == null || propertyName == VisualElement.FlowDirectionProperty.PropertyName) SetFlowDirectionFromParent(element); @@ -26,10 +28,12 @@ internal static void PropagatePropertyChanged(string propertyName, Element eleme if (propertyName == null || propertyName == Shell.NavBarIsVisibleProperty.PropertyName) BaseShellItem.PropagateFromParent(Shell.NavBarIsVisibleProperty, element); - foreach (var child in children) + foreach (var child in children.ToArray()) { if (child is IPropertyPropagationController view) + { view.PropagatePropertyChanged(propertyName); + } } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28162.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue28162.xaml new file mode 100644 index 000000000000..d78709e06c5a --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28162.xaml @@ -0,0 +1,34 @@ + + + +