【发布时间】:2021-12-29 19:04:38
【问题描述】:
我想这样当我在 Xamarin Forms 中单击(电子邮件链接)和(电话号码)时, 在用户设备上启动(电子邮件应用程序)和(电话应用程序)。
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");
}
【问题讨论】:
-
检查 Xamarin.Essentials、email 和 phone call
-
通过您发送给我的链接,我能够修复“电子邮件”按钮。我仍在尝试解决电话按钮问题
-
当我根据文档
PhoneDialer.Open(phoneNumber);使用此代码时 - 我收到错误消息Exception while opening dialer: Specified method is not supported.
标签: c# android ios xamarin.forms mobile