Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabBar nests TabBarItems when being set as ItemTemplate's root #1129

Open
kazo0 opened this issue May 9, 2024 · 1 comment
Open

TabBar nests TabBarItems when being set as ItemTemplate's root #1129

kazo0 opened this issue May 9, 2024 · 1 comment
Labels
kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.

Comments

@kazo0
Copy link
Contributor

kazo0 commented May 9, 2024

With the following XAML

<utu:TabBar SelectedIndex="3"
			ItemsSource="{Binding Data.Items}"
			Style="{StaticResource TopTabBarStyle}">
	<utu:TabBar.ItemTemplate>
		<DataTemplate>
			<utu:TabBarItem Background="Red" Content="Content" />
		</DataTemplate>
	</utu:TabBar.ItemTemplate>
</utu:TabBar>

We should be seeing this:

image

Instead, we are seeing that that TabBar now contains TabBarItems that contain the red TabBarItem as it's content:

image
@kazo0 kazo0 added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification. labels May 9, 2024
@Xiaoy312
Copy link
Contributor

Xiaoy312 commented May 9, 2024

ChipGroup\Chip suffers the same problem

Both ChipGroup and TabBar inherits from ItemsControl, and both override GetContainerForItemOverride+IsItemItsOwnContainerOverride.
This handles the case where the Items or ItemsSource contains the proper type for its item "container". However, it does not support the case where the supposed "container" is coming from the result of ItemTemplate.

That said, ListView and ListViewItem works... both on Windows and Uno somehow...
On Uno, this is done via ItemsControl::GetRootOfItemTemplateAsContainer implemented in Selector.
It is unclear how Windows is handling this..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.
Projects
None yet
Development

No branches or pull requests

2 participants