Xamarin Forms Label 添加下划线

Xamarin.Forms 版本3.2以上可以这样实现:

 <Label Grid.Row="1" Grid.ColumnSpan="4" Margin="0,10,0,0" FontSize="12">
     <Label.FormattedText>
         <FormattedString>
             <Span Text="https://wwww.cameraftp.56/parentID123456/isEmBededtrue/waipatik"
                   TextColor="Blue" x:Name="publishURL"
                   TextDecorations="Underline">
                  <Span.GestureRecognizers>
                       <!--<TapGestureRecognizer Command="{Binding ClickCommand}"                                                                       CommandParameter="https://xamarin.com" />-->
                       <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="Button_OnClicked_toviewpublish"/>
                   </Span.GestureRecognizers>
              </Span>
          <!--<Span Text=" Some more text." />-->
          </FormattedString>
      </Label.FormattedText>
      <Label.GestureRecognizers>
          <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="Button_OnClicked_toviewpublish"/>
      </Label.GestureRecognizers>
</Label>

效果:


20190806110358.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容