xaml - 使用 StringFormat、xamarin.forms 在 9 位绑定(bind)号码之间添加空格

标签 xaml xamarin xamarin.forms

我有一个绑定(bind)号码,我想在其之间添加空格。例如。目前它显示 123456789 ,我希望它显示 123 456 789 。有人知道如何使用 stringFormat 执行此操作吗?

我的xaml

<Label Text="{Binding CardNumber}" TextColor="#1481BA" />

最佳答案

您可以使用以下格式StringFormat={0:### ### ###}

例如

<Label Text="{Binding CardNumber, StringFormat={0:### ### ###}" TextColor="#1481BA" />

关于xaml - 使用 StringFormat、xamarin.forms 在 9 位绑定(bind)号码之间添加空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48095233/

相关文章:

c# - 我可以将 xaml ApplicationResources 与 MvvmCross 应用程序一起使用吗

c# - Android EditText 设置最大长度

c# - WPF 使用 XAML 将 List<KeyValuePair<,>> 绑定(bind)到 DataGrid

xaml - 为什么 Xamarin ListView 缓存策略显示 "Ambiguous Reference"?

c# - 如何找到 Windows Phone 8.1 Xaml 应用程序内存泄漏的原因?

c# - 如何以 xamarin 形式隐藏 android(返回,主页)的底部栏?

c# - 是否可以在 Xamarin Forms Android 中动态更改标签栏所选项目的颜色?

XAML 中的 WPF 日期时间。如何添加天数?

xaml - Xamarin TapGestureRecognizer 有时无法正常工作

xaml - 如何绑定(bind)样式资源字典中的颜色?