Forum Xamarin.Forms

How to make Scrollable Label in Collectionview Xamarin Forms

malukishtiaqmalukishtiaq Member ✭✭
edited March 2020 in Xamarin.Forms

Hi there!
I have a Collectionview with fixed Row Height. Inside Collectionview there is Label with large description. I am trying to make this label scrollable. Can anyone help please.

Best Answer

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    If you want the text scroll in direction Horizontal, then you can add code Orientation="Horizontal" to ScrollView .
    If we want to hide the ScrollBar, we can add following code:

      HorizontalScrollBarVisibility="Never"
    

    So the whole code is like this:

               <ScrollView Grid.Row="1" Grid.Column="1" 
                                        VerticalOptions="End" 
                                        Orientation="Horizontal" 
                                        HorizontalScrollBarVisibility="Never"
                                          >
                            <Label 
                                   LineBreakMode="WordWrap"
                                   MaxLines="1"
                                   Text="{Binding Details}"
                                   FontAttributes="Italic" />
                            </ScrollView>
    

    The result is like this:

  • malukishtiaqmalukishtiaq Member ✭✭

    It works without listview or collection view. but it does not work inside a collection

  • jezhjezh Member, Xamarin Team Xamurai

    @malukishtiaq Hi friend, have you resolved your question?

  • malukishtiaqmalukishtiaq Member ✭✭

    @jezh I have marked your question as answer. but still i would say, it doesn't work on android properly. I mean it works but It is also hard to scroll because collection view it self starts scrolling. Is there any tip on that. Like to handle its behavior.

    Thank you very much.

Sign In or Register to comment.