gpt4 book ai didi

c# - Xamarin 形成自定义单元格货币格式?

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:15:40 26 4
gpt4 key购买 nike

我有一个可以使用的自定义 FiancialCell,但不能格式化为货币。是否有另一种方法可以更改绑定(bind)格式,使其成为 $ ?

    public FinancialCell()
{
.......

//Set the bindings to the FinancialRow object to be bound to this
lblTitle.SetBinding(Label.TextProperty, "Title");

///Why does this not format to $ when displayed?
lblValue.SetBinding(Label.TextProperty, "Value", stringFormat: "C");


this.View = stack;
}

最佳答案

改用 "{0:C}" 即可。

这是您的示例,与修复程序集成在一起,只是为了完整性:-

    public FinancialCell()
{
.......

//Set the bindings to the FinancialRow object to be bound to this
lblTitle.SetBinding(Label.TextProperty, "Title");

///Why does this not format to $ when displayed?
lblValue.SetBinding(Label.TextProperty, "Value", stringFormat: "{0:C}");


this.View = stack;
}

关于c# - Xamarin 形成自定义单元格货币格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26920541/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com