I have:
<Label Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding Price, StringFormat='{0:F0} $'}" XAlign="Center" YAlign="Center" TextColor="#2bff00" FontAttributes="Bold" FontSize="Small" HorizontalOptions="CenterAndExpand"/>
But my property from the object is:
JsonProperty("price_usd")]
public decimal? Price { get; set; }
So the real value is: "price_usd":"3824.56"
and my label display 3824 without comma ?
CodePudding user response:
Take a look at numeric format strings in the documentation. Also, here are some quick examples:
String.Format("{0:0.##}", 123.4567); // "123.46"
String.Format("{0:0.##}", 123.4); // "123.4"
String.Format("{0:0.##}", 123.0); // "123"
You can use these formats inside your .xaml
.