代码片段分享

Xamarin Forms Label 添加下划线

2019-08-06  本文已影响0人  花艺荣

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
上一篇 下一篇

猜你喜欢

热点阅读