maui
maui copied to clipboard
Custom Control ItemTemplate fails to change at runtime in MAUI iOS
Description
When I create Custom Control on top of ListView and try to change ItemTemplate at runtime, The ListView does not get new ItemTemplate in iOS.
Steps to Reproduce
- Create Custom control over a
TemplatedViewwith a Collection Property and ItemTemplate Property. - Create a
ContentPageimplementing Custom control and AddDataTemplateto it. - Add
ControlTemplatewithListViewto Page. - Add Elements to
ListView. - Create Button on
ContentPageto controlItemTemplateof the Custom Control. - In Custom Control, Add logic to get
ListViewfromTemplatedChildand apply theItemTemplateon Property change ofItemTemplate.
Expected: ListView ItemTemplate Changes to newly applied ItemTemplate on Windows, Android and iOS platforms. Observed: ListView ItemTemplate Changes to newly applied ItemTemplate on Windows and Android but not on iOS.
Link to public reproduction project repository
https://github.com/prathameshnarkhede/mauiiositemtemplatebug.git
Version with bug
9.0.0-preview.7.24407.4
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Open similar issues:
- ListView with DataTemplate: rendering and scrolling broken on iOS (#24308), similarity score: 0.76
Closed similar issues:
- CollectionView ItemTemplate OnSelectTemplate is not called when the ItemsSource is updated (#20220), similarity score: 0.76
- Changing ControlTemplate on Frame dynamically from XAML with DataTrigger does not trigger change on screen (#21947), similarity score: 0.75
- RC2 - ItemTemplate of CollectionView is not updated at runtime (#6535), similarity score: 0.75
- HotReload doesn't work for DataTemplate property changes in custom controls (#10066), similarity score: 0.75
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
I can repro this issue at iOS platform on the latest 17.12.0 Preview 1.0(9.0.0-preview.7.24407.4 & 8.0.72).
Does it work if you use CollectionView @prathameshnarkhede ?
@PureWeen I tried changing from ListView to CollectionView and that worked for me. Thanks for suggestion.