Xamarin.forms 加上「;查看更多“;标签文本末尾的文本

Xamarin.forms 加上「;查看更多“;标签文本末尾的文本,xamarin.forms,xamarin.android,xamarin.ios,Xamarin.forms,Xamarin.android,Xamarin.ios,我正在用xamarin格式的标签绑定大文本。我最多使用3行,之后我将截断文本。现在,如果文本较大且被截断,我想在末尾添加“查看更多”文本 那么我如何才能在标签文本的末尾添加“查看更多”文本呢?基于Himmanshu的观点,在初始化时似乎不起作用 你得到的结果就像下面的截图查看更多信息不显示文本 我将以下行从control.customLabel.Text.Split().Length更改为control.customLabel.Text.Count(),正常工作 这里是CustomLabel.

我正在用xamarin格式的标签绑定大文本。我最多使用3行,之后我将截断文本。现在,如果文本较大且被截断,我想在末尾添加“查看更多”文本


那么我如何才能在标签文本的末尾添加“查看更多”文本呢?

基于Himmanshu的观点,在初始化时似乎不起作用

你得到的结果就像下面的截图<代码>查看更多信息不显示文本

我将以下行从
control.customLabel.Text.Split().Length
更改为
control.customLabel.Text.Count()
,正常工作

这里是
CustomLabel.xaml

<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="App25.CustomLabel">
    <ContentView.Content>
        <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
            <Label x:Name="customLabel"   >
            </Label>
            <Label x:Name="lblReadMore" FontSize="18" FontAttributes="Bold"  >
                <Label.GestureRecognizers>
                    <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
                </Label.GestureRecognizers>
            </Label>
        </StackLayout>
    </ContentView.Content>
</ContentView>
在contentpage中使用它

        <local:CustomLabel  Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."    />


这里是运行GIF

        <local:CustomLabel  Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."    />