ItemsRepeater to search DataTemplates when no ItemTemplate defined
See original GitHub issueThe ItemsRepeater is inconsistent with the other Avalonia controls in that it doesn’t appear to search the DataTemplates collections of its parent controls for a matching DataTemplate for it’s items. Instead it reverts to using ToString() when no ItemTemplate is defined; e.g.
<ItemsRepeater Items="{Binding Items}"/>
The similar ItemsControl works as expected using the DataTemplates of its parent controls.
<ItemsControl Items="{Binding Items}"/>
I think it would make sense for ItemsRepeater to default to searching the Avalonia DataTemplates collections for a matching template.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
ItemsRepeater - Windows apps
ItemsRepeater is a light-weight control to generate and present a collection of items.
Read more >ItemsRepeater
A data-driven collection control that incorporates a flexible layout system, custom views, and virtualization.
Read more >How to use UserControls in an ItemsRepeater for UWP
How to use UserControls in an ItemsRepeater for UWP. You could insert UserControl into ItemsRepeater's ItemTemplate .
Read more >Introducing WinUI ItemsRepeater and Friends
ItemsRepeater is an ideal host for this: it's a WinUI element that is designed to be used inside custom controls that display collections....
Read more >Dressing Up Your Data with WPF DataTemplates
Since the ListBox class defines an ItemTemplate property (typed as DataTemplate) and the bound data matches the DataType specified in the DataTemplate, WPF ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nrenzoni you need to use recycle pool for items repeater https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml#L25-L43
Can you share code for how to do this? I have the use case where my ItemsRepeater.Items is a collection of an abstract class type, and I’d like to have different DataTemplates per each concrete class type. I thought I could define the Data Templates in ItemsRepeater.DataTemplates, but it’s not being referenced, similar to this github issue.