enisn / UraniumUI

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

[TabView] CollectionView inside Tabview does not scroll #614

Open graspbow opened 2 months ago

graspbow commented 2 months ago

I am using a TabView with a CollectionView in it. The CollectionView won't scroll unless I wrap it in a Grid and give it a HeightRequest(Which I would like to avoid). Is there any other solution for this?

I have only tested this on Android.

This is the setup:

<material:TabView CachingStrategy="CacheOnLayout">
    <material:TabView.TabHeaderItemTemplate>
        <DataTemplate>
            <Button Text="{Binding Title}"
                    Command="{Binding Command}">
                <Button.Triggers>
                    <DataTrigger TargetType="Button"
                                 Binding="{Binding IsSelected}"
                                 Value="True">
                        <Setter Property="BackgroundColor"
                                Value="Orange" />
                        <Setter Property="TextColor"
                                Value="White" />
                    </DataTrigger>
                    <DataTrigger TargetType="Button"
                                 Binding="{Binding IsSelected}"
                                 Value="False">
                        <Setter Property="BackgroundColor"
                                Value="Gray" />
                        <Setter Property="TextColor"
                                Value="Black" />
                    </DataTrigger>
                </Button.Triggers>
            </Button>
        </DataTemplate>
    </material:TabView.TabHeaderItemTemplate>
    <material:TabItem Title="Tab1">
        <material:TabItem.ContentTemplate>
            <DataTemplate>
                <CollectionView ItemsSource="{Binding ToDoList}">
                    <CollectionView.ItemTemplate>
                        <DataTemplate>
                                <VerticalStackLayout>
                                    <Label Text="{Binding .}" />
                                    <Label Text="Test" />
                                </VerticalStackLayout>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                </CollectionView>
            </DataTemplate>
        </material:TabItem.ContentTemplate>
    </material:TabItem>
    <material:TabItem Title="Tab2">
        <material:TabItem.ContentTemplate>
            <DataTemplate>
                <CollectionView ItemsSource="{Binding ProcessedList}">
                    <CollectionView.ItemTemplate>
                        <DataTemplate>
                                <Label Text="Test" />
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                </CollectionView>
            </DataTemplate>
        </material:TabItem.ContentTemplate>
    </material:TabItem>
</material:TabView>