HyperlinkButton in C# XAMARIN.FORMS

后端 未结 7 1503
南方客
南方客 2021-02-19 02:36

I want to create Label with click possibility like in WIN phone xaml


Is there a possibili

7条回答
  •  心在旅途
    2021-02-19 03:05

    This is a class I use to have a label act as a link:

    public class SimpleLinkLabel : Label
    {
        public SimpleLinkLabel(Uri uri, string labelText = null)
        {
            Text = labelText ?? uri.ToString();
            GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => Device.OpenUri(uri)) });
        }
    }
    

    For more options, this answer about creating a hyperlink in Xamarin Forms might be useful.

提交回复
热议问题