HyperlinkButton in C# XAMARIN.FORMS

后端 未结 7 1483
南方客
南方客 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:14

    XAML code would be as follows:

    <Label
        Text="My Text to click"
        HorizontalOptions="Center" >
    
        <Label.GestureRecognizers>
            <TapGestureRecognizer
                Tapped="OnLabelTapped"
                NumberOfTapsRequired="2" />
        </Label.GestureRecognizers>
    </Label>
    

    Note: By default, NumberOfTapsRequired is 1.

    Then in your .cs file, add the method OnLabelTapped.

    public void OnLabelTapped(object sender, EventArgs args)
    {
        // Your code here
        // Example:
        // DisplayAlert("Message", "You clicked on the label", "OK");
    }
    
    0 讨论(0)
提交回复
热议问题