c# - 如何在文本属性中放置不同的文本格式和超链接
问题描述
我想在我的 xamarin.forms 项目中使用 syncfusion 复选框,并且 text 属性应包含单个单词块上的超链接,该超链接应如下划线:
[ ] 继续注册帐户即表示您同意“条款和条件”
词块“条款和条件”应带有超链接下划线。
复选框的 XAML 如下所示:
<SfCheckBox x:Name="checkBoxIsAgreed" Text="text here"/>
如何仅使用作为字符串的文本属性来实现此目的?
提前致谢!
解决方案
更好的是,您可以将文本和复选框分开,如下所示。
<StackLayout Orientation="Vertical">
<SfCheckBox Text="text here"/>
<Label>
<Label.FormattedText>
<FormattedString>
<Span Text="Text Here" />
<Span Text="Terms and Conditions" TextDecorations="Underline">
<Span.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
推荐阅读
- python - Python SQLAlchemy engine.execute:数据参数不能是迭代器
- jags - JAGS 中的 4 维选择数组
- typescript - 接口名称周围的方括号是什么意思?
- c - 调试神秘的 git+ssh+proxy 失败“bash:没有这样的文件或目录”的艰难方法
- embedded - ST-Link 无连接
- python - 如何在命令行 shell 中运行内联 Python 代码?
- python - ValueError:找到具有 1 个特征的数组,而至少需要 2 个特征
- java - 当 Spring Boot Oauth2 授权服务器中的 grant_type=client_credentials 时如何为错误的凭据抛出任何异常
- asp.net - VS2019 v16.8.1新项目模板未加载
- python-3.x - 如何检查 asyncio create_server 是否失败?