ListView group header style on iOS
This .NET Multi-platform App UI (.NET MAUI) iOS platform-specific controls whether ListView header cells float during scrolling. It's consumed in XAML by setting the ListView.GroupHeaderStyle
bindable property to a value of the GroupHeaderStyle
enumeration:
<ContentPage ...
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls">
<StackLayout Margin="20">
<ListView ... ios:ListView.GroupHeaderStyle="Grouped">
...
</ListView>
</StackLayout>
</ContentPage>
Alternatively, it can be consumed from C# using the fluent API:
using Microsoft.Maui.Controls.PlatformConfiguration;
using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;
...
listView.On<iOS>().SetGroupHeaderStyle(GroupHeaderStyle.Grouped);
The ListView.On<iOS>
method specifies that this platform-specific will only run on iOS. The ListView.SetGroupHeaderStyle
method, in the Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific
namespace, is used to control whether ListView header cells float during scrolling. The GroupHeaderStyle
enumeration provides two possible values:
Plain
– indicates that header cells float when the ListView is scrolled (default).Grouped
– indicates that header cells do not float when the ListView is scrolled.
In addition, the ListView.GetGroupHeaderStyle
method can be used to return the GroupHeaderStyle
that's applied to the ListView.
The result is that a specified GroupHeaderStyle
value is applied to the ListView, which controls whether header cells float during scrolling: