nix
nix

Reputation: 2285

How to wrap text in ListView's TextCell?

How to wrap text in ListView's TextCell? I tried setting HasUnevenRows to True but that didn't help.

Upvotes: 4

Views: 5601

Answers (1)

Jake Shanley
Jake Shanley

Reputation: 913

You cannot with Xamarin's 'out-of-the-box' TextCell features. BUT, you should be able to create a ViewCell and leverage the LineBreakMode property of Label to accomplish word wrapping. Something like this perhaps:

<ListView>
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <StackLayout>
                    <Label Text="My TextCell Text" LineBreakMode="WordWrap"/>
                    <Label Text="My TextCell Detail" LineBreakMode="WordWrap"/>
                </StackLayout>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

Upvotes: 10

Related Questions