Description
XAML Source Generator (XSG) does not correctly handle SwipeItems (a non-visual collection type) when defined as a resource and then referenced via StaticResource in LeftItems/RightItems properties.
Reproduction
<ContentPage.Resources>
<ResourceDictionary>
<SwipeItems x:Key="FavouriteSwipeItems">
<SwipeItem
Text="Favourite"
IconImageSource="calculator.png"
BackgroundColor="Yellow"
Command="{Binding Source={x:Reference SwipeCollectionView}, Path=BindingContext.FavouriteCommand}"/>
</SwipeItems>
<SwipeItems x:Key="DeleteSwipeItems" Mode="Execute">
<SwipeItem
Text="Delete"
IconImageSource="coffee.png"
BackgroundColor="Red"
Command="{Binding Source={x:Reference SwipeCollectionView}, Path=BindingContext.DeleteCommand}"/>
</SwipeItems>
<DataTemplate x:Key="MessageTemplate">
<SwipeView
HeightRequest="80"
LeftItems="{StaticResource FavouriteSwipeItems}"
RightItems="{StaticResource DeleteSwipeItems}">
<!-- content -->
</SwipeView>
</DataTemplate>
</ResourceDictionary>
</ContentPage.Resources>
Affected Files
Multiple files in src/Controls/samples/Controls.Sample/Pages/Controls/SwipeViewGalleries/:
ResourceSwipeItemsGallery.xaml
- And potentially other SwipeView gallery files
Workaround
Use Inflator="Runtime" for the affected XAML files.
Context
Discovered while enabling XSG on more projects in #33524.
Description
XAML Source Generator (XSG) does not correctly handle
SwipeItems(a non-visual collection type) when defined as a resource and then referenced viaStaticResourceinLeftItems/RightItemsproperties.Reproduction
Affected Files
Multiple files in
src/Controls/samples/Controls.Sample/Pages/Controls/SwipeViewGalleries/:ResourceSwipeItemsGallery.xamlWorkaround
Use
Inflator="Runtime"for the affected XAML files.Context
Discovered while enabling XSG on more projects in #33524.