I have a UWP page with a Pivot control, where ItemTemplateSelector is bounded to a DataTemplateSelector derived class. The code works as expected, and here is the XAML snippet
<Pivot IsHeaderItemsCarouselEnabled="False"
ItemsSource ="{x:Bind MainPageViewModel.EditViewModels}"
ItemTemplateSelector="{StaticResource DetailViewTemplateSelector}" >
<Pivot.HeaderTemplate>
<DataTemplate >
<TextBlock Text="New Item"/>
</DataTemplate>
</Pivot.HeaderTemplate>
</Pivot>
I have a resource dictionary where the data template is defined as:
<DataTemplate x:Key="Tabela_DetailViewModel" >
<detailView:Tabela_View />
</DataTemplate>
The code works as expected. As I add objects to the itemsource, new pivot items are created and their contents are rendered with the user control Tabela_View.
I changed the Pivot control to TabView from the Microsoft.Toolkit.Uwp.UI.Controls nampespace. After changing the control, when I open a new tab, the type name is rendered instead of the user control view. Here is XAML of the TabView:
<muxc:TabView x:Name="Tabs" Grid.Column="1" Grid.Row="0"
ItemsSource ="{x:Bind MainPageViewModel.EditViewModels}"
SelectedItem="{x:Bind MainPageViewModel.SelectedEntityViewModel,Mode=TwoWay}"
ItemTemplateSelector="{StaticResource DetailViewTemplateSelector}" >
<muxc:TabView.ItemHeaderTemplate>
<DataTemplate >
<TextBlock Text="New Item"/>
</DataTemplate>
</muxc:TabView.ItemHeaderTemplate>
</muxc:TabView>
Here is a link for the project project link that simulates this error. Note that the commented pivot control snippet works as expected
Any help will be greatly appreciated. Regards, Saifi