XamarinCommunityToolkit icon indicating copy to clipboard operation
XamarinCommunityToolkit copied to clipboard

[Bug] TabViewItem.IsSelected is never set when using TabView with TabItemsSource

Open tranb3r opened this issue 3 years ago • 0 comments

Description

When using a TabView with TabItemsSource, several TabViewItem properties are never used, for example TextColorSelected. The reason for this issue seems to be that TabViewItem.IsSelected is never set (in a TabItemsSource scenario). No issue when defining the TabViewItems in the xaml page (instead of using a TabItemsSource).

Steps to Reproduce

In the sample project, in file TabItemsSourcePage.xaml, replace

            <DataTemplate x:Key="TabViewItemTemplate">
                <Grid>
                    <Label
                        Text="{Binding Name}"
                        HorizontalOptions="Center"
                        VerticalOptions="Center" 
                        TextColor="White"
                        Margin="12, 0"/>
                </Grid>
            </DataTemplate>

with

            <ControlTemplate x:Key="TabViewItemControlTemplate">
                <Label
                    Text="{TemplateBinding Text}"
                    HorizontalOptions="Center"
                    VerticalOptions="Center"
                    TextColor="{TemplateBinding CurrentTextColor}"
                    Margin="12,0" />
            </ControlTemplate>

            <DataTemplate x:Key="TabViewItemTemplate">
                <xct:TabViewItem
                    ControlTemplate="{StaticResource TabViewItemControlTemplate}"
                    Text="{Binding Name}"
                    TextColor="White"
                    TextColorSelected="Red" />
            </DataTemplate>

Expected Behavior

The selected tab TextColor should be the TextColorSelected (Red).

Actual Behavior

The selected tab TextColor is the TextColor (White).

Basic Information

  • Version with issue: 2.0.0

tranb3r avatar Feb 25 '22 11:02 tranb3r