TabView icon indicating copy to clipboard operation
TabView copied to clipboard

Tab view HeaderSelectionUnderlineWidth not working

Open mrobraven opened this issue 3 years ago • 2 comments

I am setting the HeaderSelectionUnderlineWidth value and through hot reload, the changes show fine but when rebuilding the line goes back to being the same length as the tab width for some reason?

mrobraven avatar Jul 04 '21 12:07 mrobraven

Can you share some sample code?

chaosifier avatar Jul 04 '21 13:07 chaosifier

@chaosifier I have simplified the code by removing the other elements in the base stacklayout which are just a few labels for the page title:

<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:Forms9Patch="clr-namespace:Forms9Patch;assembly=Forms9Patch" xmlns:vocal="clr-namespace:Vocal" xmlns:tabview="clr-namespace:Xam.Plugin.TabView;assembly=Xam.Plugin.TabView" xmlns:magicgradients="clr-namespace:MagicGradients;assembly=MagicGradients" x:Class="Vocal.SearchPage" NavigationPage.HasNavigationBar="False">
    <StackLayout BackgroundColor="WhiteSmoke">
        <tabview:TabViewControl x:Name="tabController" TranslationX="-15" Margin="0,0,-10,0" VerticalOptions="FillAndExpand" BackgroundColor="White" HeaderTabTextFontFamily="Book" HeaderTabTextFontSize="16" HeaderBackgroundColor="WhiteSmoke" HeaderTabTextColor="#707070" HeaderSelectionUnderlineColor="#ec669e" HeaderSelectionUnderlineThickness="2">

            <tabview:TabViewControl.ItemSource>

                <tabview:TabItem HeaderText="All" HeaderSelectionUnderlineWidth="30">

                    <!-- ENTIRE VIEW -->
                    <ScrollView Orientation="Vertical">

                        <StackLayout Margin="15,10,15,0">

                            <RelativeLayout VerticalOptions="Fill" HeightRequest="28">

                                <Forms9Patch:Label Text="People" TextColor="DarkSlateGray" FontFamily="Vocal.Resources.Fonts.FuturaPTBold.otf" Lines="0" AutoFit="Width" FontSize="50" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.06 }" />
                                <Forms9Patch:Label Text="See More" VerticalTextAlignment="Center" TextColor="DodgerBlue" FontFamily="Vocal.Resources.Fonts.FuturaPTBook.otf" Lines="1" AutoFit="Width" FontSize="50" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.17}" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.769 }">
                                    <Forms9Patch:Label.GestureRecognizers>
                                        <TapGestureRecognizer Command="{Binding ChangeTab}" CommandParameter="people" />
                                    </Forms9Patch:Label.GestureRecognizers>
                                </Forms9Patch:Label>

                            </RelativeLayout>

                            <StackLayout x:Name="mainPeopleView" VerticalOptions="Fill" Margin="15,0">

                                <!-- CODEBEHIND ADDS HERE -->

                            </StackLayout>

                            <RelativeLayout VerticalOptions="Fill" HeightRequest="28" Margin="0,15,0,0">

                                <Forms9Patch:Label Text="Tags" TextColor="DarkSlateGray" FontFamily="Vocal.Resources.Fonts.FuturaPTBold.otf" Lines="0" AutoFit="Width" FontSize="50" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.06 }" />
                                <Forms9Patch:Label Text="See More" VerticalTextAlignment="Center" TextColor="DodgerBlue" FontFamily="Vocal.Resources.Fonts.FuturaPTBook.otf" Lines="1" AutoFit="Width" FontSize="50" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.17}" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.769 }">
                                    <Forms9Patch:Label.GestureRecognizers>
                                        <TapGestureRecognizer Command="{Binding ChangeTab}" CommandParameter="tags" />
                                    </Forms9Patch:Label.GestureRecognizers>
                                </Forms9Patch:Label>

                            </RelativeLayout>

                            <Grid x:Name="mainTagView" HeightRequest="120" VerticalOptions="Fill" Margin="15,0">

                                <Grid.RowDefinitions>
                                    <RowDefinition Height='*' />
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <!-- CODEBEHIND ADDS HERE -->

                            </Grid>

                            <RelativeLayout VerticalOptions="Fill" HeightRequest="28" Margin="0,15,0,0">

                                <Forms9Patch:Label Text="Communities" TextColor="DarkSlateGray" FontFamily="Vocal.Resources.Fonts.FuturaPTBold.otf" Lines="0" AutoFit="Width" FontSize="50" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.06 }" />
                                <Forms9Patch:Label Text="See More" VerticalTextAlignment="Center" TextColor="DodgerBlue" FontFamily="Vocal.Resources.Fonts.FuturaPTBook.otf" Lines="1" AutoFit="Width" FontSize="50" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.17}" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.769 }">
                                    <Forms9Patch:Label.GestureRecognizers>
                                        <TapGestureRecognizer Command="{Binding ChangeTab}" CommandParameter="groups" />
                                    </Forms9Patch:Label.GestureRecognizers>
                                </Forms9Patch:Label>

                            </RelativeLayout>

                            <StackLayout x:Name="mainGroupView" VerticalOptions="Fill" Margin="15,0">

                                <!-- CODEBEHIND ADDS HERE -->

                            </StackLayout>

                        </StackLayout>

                    </ScrollView>

                </tabview:TabItem>

                <tabview:TabItem HeaderText="People" HeaderSelectionUnderlineWidth="55">

                    <!-- ENTIRE VIEW -->
                    <ScrollView Orientation="Vertical">

                        <StackLayout>

                            <RelativeLayout VerticalOptions="Fill" HeightRequest="30">

                                <Forms9Patch:Label Text="People" FontFamily="Vocal.Resources.Fonts.FuturaPTBold.otf" Lines="0" AutoFit="Width" FontSize="50" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.06 }" />

                            </RelativeLayout>

                            <StackLayout x:Name="peopleView" VerticalOptions="Fill" Margin="15,0">

                                <!-- CODEBEHIND ADDS HERE -->

                            </StackLayout>

                        </StackLayout>

                    </ScrollView>

                </tabview:TabItem>

                <tabview:TabItem HeaderText="Tags" HeaderSelectionUnderlineWidth="36">

                    <!-- ENTIRE VIEW -->
                    <ScrollView Orientation="Vertical">

                        <StackLayout>

                            <RelativeLayout VerticalOptions="Fill" HeightRequest="30">

                                <Forms9Patch:Label Text="Tags" FontFamily="Vocal.Resources.Fonts.FuturaPTBold.otf" Lines="0" AutoFit="Width" FontSize="50" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.06 }" />

                            </RelativeLayout>

                            <Grid x:Name="tagsView" VerticalOptions="FillAndExpand" Margin="15,0">

                                <Grid.RowDefinitions>
                                    <RowDefinition Height='50' />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <!-- CODEBEHIND ADDS HERE -->

                            </Grid>

                        </StackLayout>

                    </ScrollView>

                </tabview:TabItem>

                <tabview:TabItem HeaderText="Communities" HeaderSelectionUnderlineWidth="60">

                    <!-- ENTIRE VIEW -->
                    <ScrollView Orientation="Vertical">

                        <StackLayout>

                            <RelativeLayout VerticalOptions="Fill" HeightRequest="30">

                                <Forms9Patch:Label Text="Communities" FontFamily="Vocal.Resources.Fonts.FuturaPTBold.otf" Lines="0" AutoFit="Width" FontSize="50" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.06 }" />

                            </RelativeLayout>

                            <StackLayout x:Name="groupView" VerticalOptions="Fill" Margin="15,0">

                                <!-- CODEBEHIND ADDS HERE -->

                            </StackLayout>

                        </StackLayout>

                    </ScrollView>

                </tabview:TabItem>

            </tabview:TabViewControl.ItemSource>

        </tabview:TabViewControl>

    </StackLayout>
</ContentPage>

mrobraven avatar Jul 04 '21 14:07 mrobraven