maui

MAUI: Listview is not visible when adding FlowDirection and Rotation


The ListView is not visible when adding FlowDirection and Rotation properties. The Listview was visible before adding FlowDirection and Rotation.

<ListView 
    -------
    FlowDirection="RightToLeft"
    Rotation="180"
    ------------->
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <ViewCell.View>
                    <StackLayout
                        -------------
                        FlowDirection="LeftToRight"
                        Rotation="180"
                        -------------> 

I found a similar issue here. I have created a sample project to reproduce this issue. Any solutions available?


Solution

  • I have reproduced this problem you can follow up the issue you found.

    What I found:

    1. If the value of the Rotation smaller than 90, such as 45 or 10. You can see a part of the ListView.
    2. Even though the listview is not visible when you set Rotation="180", the height and width has value.

    So the problem is the center of the listview's rotation.

    And for a workaround, you can add a parent view for the ListView and then set Rotation="180" for its parent. Such as:

    <Border Rotation="180">
        <ListView 
        -------
        FlowDirection="RightToLeft"
    

    In addition, you can also use the CollectionView instead of the ListView. This issue only appears on ListView.