HyperlinkBut​​ton在C#XAMARIN.FORMS

问题描述:

我要像在WIN手机XAML创建点击可能性标签

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

<HyperlinkButton Content="My Text to click"/>



有没有可能做到在Xamarin.Forms?

Is there a possibility to do it in Xamarin.Forms?

我发现这不过是不一样的:

I found this but is not the same:

https://github.com/XLabs/Xamarin-Forms-Labs/wiki/HyperLinkLabel

我会建议使用 GestureRecognizers 并添加点击手势来的标签。 编号:这里

I would suggest using GestureRecognizers and adding a Tap Gesture to a label. Ref: here

var label = new Label()
{
  Text="My Hyperlink"
};
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += (s, e) => {
    // handle the tap
};
label.GestureRecognizers.Add(tapGestureRecognizer);



GestureRecognizer 是一个公共财产查看标签从继承。看到这里

GestureRecognizer is a public property on the View class which Label inherits from. See here