uno.toolkit.ui icon indicating copy to clipboard operation
uno.toolkit.ui copied to clipboard

[IR-ext] selection support for complex ItemTemplate

Open Xiaoy312 opened this issue 2 years ago • 1 comments

Anything else we need to know?

By design, IR-extensions only properly supports selection if the root element in the item-template is a SelectorItem derived class.

What would you like to be added:

Allow the target element of selection to be not just the template root.

This should probably be done through some marker property, ex:

<muxc:ItemsRepeater ItemsSource="ASD"
					utu:ItemsRepeaterExtensions.SelectionMode="Single">
	<muxc:ItemsRepeater.ItemTemplate>
		<DataTemplate> 
			<Border>
				<utu:Chip Content="{Binding}" utu:ItemsRepeaterExtensions.IsSelectionTarget="True" />
			</Border>
		</DataTemplate>
	</muxc:ItemsRepeater.ItemTemplate>
</muxc:ItemsRepeater>

or

<muxc:ItemsRepeater ItemsSource="ASD"
					utu:ItemsRepeaterExtensions.SelectionMode="Single"
					utu:ItemsRepeaterExtensions.SelectionTargetName="Selectable">
	<muxc:ItemsRepeater.ItemTemplate>
		<DataTemplate> 
			<Border>
				<utu:Chip x:Name="Selectable" Content="{Binding}" />
			</Border>
		</DataTemplate>
	</muxc:ItemsRepeater.ItemTemplate>
</muxc:ItemsRepeater>

Why is this needed:

In figma, we often encounter case where it is impossible to generate a "clean/lean" item-template. And, we need to support these scenario, where the targeted SelectorItem can be found nested under the item-template.

For which Platform: all

Xiaoy312 avatar Jun 13 '23 18:06 Xiaoy312

re: unoplatform/Uno.Figma#1612

Xiaoy312 avatar Jun 13 '23 18:06 Xiaoy312