我想这样做,当我在Xamarin表单中单击(电子邮件链接(和(电话号码(时,在用户设备上启动(电子邮件应用程序(和(电话应用程序(。
Xaml
<Label HorizontalTextAlignment="Start"
Style="{StaticResource DescriptionLabelStyle}">
<Label.FormattedText>
<FormattedString>
<Span Text="{x:Static resources:Lang.AccessibilityRepDesc}" />
<Span Text="goteborg@goteborg.se"
TextColor="{DynamicResource HyperLink}">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding EmailCommand}" />
</Span.GestureRecognizers>
</Span>
<Span Text="{helpers:Translate OrCall}" />
<Span Text="031-3650000"
TextColor="{DynamicResource HyperLink}">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding PhoneCommand}"/>
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
背后的代码
private void EmailClicked(object obj)
{
Console.WriteLine("Sending Email");
}
private void PhoneClicked(object obj)
{
Console.WriteLine("Making a phonecall");
}
我能够通过休耕这个后来修复它
在Nuget上使用(Xam.Plugins.Messageing(真的很容易修复。我已经在安卓系统上进行了测试,我还没有在iOS上进行测试。
您可能正在寻找类似Xamarin Essentials的产品。它有很多好的API。有一个电子邮件API,你可以在这些文档中阅读它