Repository navigation
Done
Labels
feature-pending-triageA new feature request pending triage to confirm validity.
Description
Is your feature request related to a problem? Please describe.
ListView.stickyHeaderTemplate only works reliably as an inline XML string attribute:
<ListView items="{{ items }}" sectioned="true" stickyHeader="true"
stickyHeaderTemplate="<Label text='{{ title }}' />">
Long or nested header layouts are awkward to write in an escaped attribute string. The natural way to write them, the same way itemTemplate works, fails:
<ListView items="{{ items }}" sectioned="true" stickyHeader="true">
<ListView.stickyHeaderTemplate>
<StackLayout class="section-header">
<Label text="{{ title }}" />
</StackLayout>
</ListView.stickyHeaderTemplate>
<ListView.itemTemplate>
<Label text="{{ name }}" />
</ListView.itemTemplate>
</ListView>
Current behavior:
- iOS: show empty label.
- Android: each header shows a generic Section N label instead of the template.
stickyHeaderTemplate is not registered in Builder.knownTemplates, which only contains itemTemplate.
A function template has a related gap. The property is typed string | Template, but Android only handles strings. A function template set in code or by a framework renderer (Angular/Vue/Svelte via UI_USE_EXTERNAL_RENDERER) is ignored on Android, while it works on iOS.
Describe the solution you'd like
Make stickyHeaderTemplate a first-class template, like itemTemplate:
- Add 'stickyHeaderTemplate' to Builder.knownTemplates so the element form <ListView.stickyHeaderTemplate> yields a Template factory.
- Resolve the header view in one shared ListViewBase helper used by both platforms. Builder.parse(value, context) already handles both an XML string and a Template function. If no template is given, or it fails to build, fall back to a Section N label.
- Support all three forms on both iOS and Android:
- an inline string attribute;
- a <ListView.stickyHeaderTemplate> element;
- a Template function set in code or by external renderers.
Describe alternatives you've considered
- Keep using the inline string attribute. This works, but it's hard to read and maintain for anything beyond a single Label. It also needs escaped quotes and offers no editor support.
- Set a function template in code-behind. This works on iOS only; Android ignores it.
Anything else?
- The property is already declared as string | Template in packages/core/ui/list-view/index.d.ts, so this aligns the runtime behavior with the public type. It doesn't add new API.
- KeyedTemplate ({ key, createView }) is out of scope, since a single header template has no use for a key.
Please accept these terms
- I have searched the existing issues as well as StackOverflow and this has not been posted before
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
feature-pending-triageA new feature request pending triage to confirm validity.
Activity
fix(core): support stickyHeaderTemplate as an XML element template (N…