如何在ListView的TextCell中包装文字? [英] How to wrap text in ListView's TextCell?

查看:75
本文介绍了如何在ListView的TextCell中包装文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在ListView的TextCell中包装文本?我尝试将HasUnevenRows设置为True,但这没有帮助.

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

推荐答案

您不能使用Xamarin的开箱即用" TextCell功能.但是,您应该能够创建ViewCell并利用 LineBreakMode 属性以完成自动换行.可能是这样的:

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>

这篇关于如何在ListView的TextCell中包装文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆