microsoft-ui-xaml: ItemsRepeater.ItemTemplate does not work with RecyclingElementFactory or IElementFactory

Describe the bug I try to use the RecyclingElementFactory or IElementFactory as an ItemsRepeater.ItemTemplate but fail - app crashes. Doc here - https://docs.microsoft.com/ru-ru/uwp/api/microsoft.ui.xaml.controls.itemsrepeater.itemtemplate?view=winui-2.4

Steps to reproduce the bug

  1. Create xaml like following:
<ItemsRepeater ItemsSource="{x:Bind Items}">
	<ItemsRepeater.ItemTemplate>
		<RecyclingElementFactory/>
	</ItemsRepeater.ItemTemplate>
</ItemsRepeater>

Expected behavior All works fine.

Version Info NuGet package version: [Microsoft.WinUI 3.0.0-preview2.200713.0]

Windows app type:

UWP Win32
No Yes
Windows 10 version Saw the problem?
May 2020 Update (19041) Yes
Device form factor Saw the problem?
Desktop Yes

Additional context I have attached an example. App17.zip

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

I have mistaken. All works as expected. For example:

<ScrollViewer>
	<ItemsRepeater ItemsSource="{x:Bind Items}">
		<ItemsRepeater.ItemTemplate>
			<RecyclingElementFactory>
				<DataTemplate x:Key="item" x:DataType="local:Item">
					<TextBlock Text="{x:Bind Value}"/>
				</DataTemplate>
				<RecyclingElementFactory.RecyclePool>
					<RecyclePool/>
				</RecyclingElementFactory.RecyclePool>
			</RecyclingElementFactory>
		</ItemsRepeater.ItemTemplate>
	</ItemsRepeater>
</ScrollViewer>
public class Item : INotifyPropertyChanged {
	public string Value { get; set; }

	public event PropertyChangedEventHandler PropertyChanged;
}

Many thanks!

@zed220 what is it you are trying to achieve by passing an empty data template ,selector or factory ? You can pass in a rectangle or something which is not visible which could achieve the same desired result perhaps ?