enisn / UraniumUI

Uranium is a Free & Open-Source UI Kit for MAUI.
Apache License 2.0
1.17k stars 142 forks source link

Tabview - custom header template does not work in release mode. #551

Open ketakidevendra opened 9 months ago

ketakidevendra commented 9 months ago

I have used a custom header template like in sample below. It works in debug mode but in release mode tabs become invisible. Version I am referring is 2.7.4.

Example:

enisn commented 9 months ago

Can you provide platform information? Which platform does this problem occur on? and which version?

ketakidevendra commented 9 months ago

.NET 8 Android

On Tue, 23 Jan, 2024, 15:28 Enis Necipoglu, @.***> wrote:

Can you provide platform information? Which platform does this problem occur on? and which version?

— Reply to this email directly, view it on GitHub https://github.com/enisn/UraniumUI/issues/551#issuecomment-1905694335, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMY57NP2ZOWYNUNURUOO5M3YP6CWBAVCNFSM6AAAAABCGUCZB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBVGY4TIMZTGU . You are receiving this because you authored the thread.Message ID: @.***>

ArtjomP commented 9 months ago

The same on UraniumUI 2.7.4 & 2.8.0-pre.2 .Net 8 Windows

enisn commented 9 months ago

You can share if you have logs of the crash.

I couldn't reproduce it in Release mode. Did you publish the application?

ArtjomP commented 9 months ago

You can share if you have logs of the crash.

I couldn't reproduce it in Release mode. Did you publish the application?

It doesn't crash just headers don't appear.

ArtjomP commented 9 months ago

As workaround I added grid and it helped. When I have:

<material:TabView.TabHeaderItemTemplate>
    <DataTemplate>
        <Grid
            HeightRequest="80"
            BackgroundColor="Azure">
            <Label
            Padding="4"
            Background="Transparent"
            FontFamily="OnestRegular"
            FontSize="14"
            HorizontalOptions="CenterAndExpand"
            LineBreakMode="TailTruncation"
            Text="{Binding Title, Converter={StaticResource TextCaseConverter}}">
                <Label.Triggers>
                    <DataTrigger
                    Binding="{Binding IsSelected}"
                    TargetType="Label"
                    Value="True">
                        <Setter Property="TextColor" Value="{DynamicResource SelectedTextColor}" />
                    </DataTrigger>
                    <DataTrigger
                    Binding="{Binding IsSelected}"
                    TargetType="Label"
                    Value="False">
                        <Setter 
                        Property="TextColor" 
                        Value="{DynamicResource SecondaryTextColor}" />
                    </DataTrigger>
                </Label.Triggers>
            </Label>
        </Grid>
    </DataTemplate>
</material:TabView.TabHeaderItemTemplate>

I get:

image

When I have:

<material:TabView.TabHeaderItemTemplate>
    <DataTemplate>
        <Label 
            Text="{Binding Title, 
                Converter={StaticResource TextCaseConverter}}" 
                Background="Transparent"
                FontSize="14" 
                Padding="4"
                LineBreakMode="TailTruncation"
                HorizontalOptions="CenterAndExpand"
                FontFamily="OnestRegular">
            <Label.Triggers>
                <DataTrigger 
                    TargetType="Label" 
                    Binding="{Binding IsSelected}" 
                    Value="True">
                    <Setter 
                        Property="TextColor" 
                        Value="{DynamicResource SelectedTextColor}" />
                </DataTrigger>
                <DataTrigger 
                    TargetType="Label" 
                    Binding="{Binding IsSelected}" 
                    Value="False">
                    <Setter 
                        Property="TextColor" 
                        Value="{DynamicResource SecondaryTextColor}" />
                </DataTrigger>
            </Label.Triggers>
        </Label>
    </DataTemplate>
</material:TabView.TabHeaderItemTemplate>

I get:

image
enisn commented 9 months ago

Thanks for your workaround, I should wrap the header with a ContentView or Grid.

I'll try to handle it. Thanks for defining the problem 🙏

ketakidevendra commented 6 months ago

@enisn - Unfortunately workaround mentioned above did not work for me in android. Is it possible to fix it?

GoSupportAfk commented 6 months ago

I ran into this issue today, and the Grid/ContentView workaround also didn't work for me.

While troubleshooting, I noticed that the Label text rendered correctly when hardcoded (not using a Binding).

I got it to work by setting the DataType on the DataTemplate.

From this:

<DataTemplate>

to this:

<DataTemplate x:DataType="uui:TabItem">

@ketakidevendra, maybe this will work for you?

osekom commented 3 months ago

any solution for this problem? I am currently seeing it in .NET 8 Android 2.8.1 @GoSupportAfk

StepKie commented 3 months ago

@enisn Not sure if possibly also related to issues observed in https://github.com/enisn/UraniumUI/issues/663#issuecomment-2229023198