【问题标题】:type hyperlink not found in xmlns http://xamarin.com/schemas/2014/forms在 xmlns http://xamarin.com/schemas/2014/forms 中找不到类型超链接
【发布时间】:2017-03-30 13:11:50
【问题描述】:

我正在尝试制作一个应用程序,并且我想拥有带有超链接的文本,但是每当我尝试运行我的应用程序时,它都会给我这个错误:“错误位置 68:40。在 xmlns http://xamarin.com/schemas/2014/forms 中找不到类型超链接FamilyEvents C:\desenv\Family\FamilyEvents\DetailsPage.xaml 68 "

我的代码是这样的:

My code

【问题讨论】:

  • 请附上代码,而不是图片

标签: listview hyperlink xamarin.forms label navigateuri


【解决方案1】:

<Hyperlink /> 不是 Xamarin Forms 控件。

您可以通过使用Label 控件和TapGestureRecognizer 来实现类似的效果。

【讨论】:

    【解决方案2】:

    您使用的类型 Hyperlink 不是 Xamarin.Forms 中的控件,因此它会给您一个错误,指出它不是在默认命名空间中找到的类型。

    如果您想要这样的功能,请使用Label 控件,您可以使用TapGestureRecognizer 来点击该控件。代码可能如下所示:

    <Label Text="My link">
        <Label.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnTapGestureRecognizerTapped" NumberOfTapsRequired="1" />
        </Label.GestureRecognizers>
    </Label>
    

    并在您的代码后面实现OnTapGestureRecognizerTapped 事件,该事件会打开您的链接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-05-13
      • 2021-02-22
      • 1970-01-01
      • 1970-01-01
      • 2011-04-19
      • 1970-01-01
      • 2012-05-31
      相关资源
      最近更新 更多