Hello,
Although you can pass a value to CellContentFormat, the actual format value isn't a feature of the DataGrid or Telerik UI for Xamarin, but rather a .NET feature. You can use any approach that work in .NET Core for the string format.
For this type of format, you can't use a traditional XAML syntax. You can however use a
DataGridTemplateColumn and use a value converter to get a custom result. I wrote a small example,
NOTE: since my PC's Culture uses the "-$ " format by default, I switched to using parenthesis in my demo. Here's a screenshot at run-time:
Before getting started, be sure to
look at the list of values in the table under the Remarks section in the Microsoft Documentation you linked to. You'll see a list of values:
I used 15, you can choose the one that you want to use instead.
public
partial
class
StartPage : ContentPage
{
public
StartPage()
{
InitializeComponent();
dataGrid.ItemsSource =
new
ObservableCollection<CountryProva>
{
new
CountryProva(
"Mozambique"
, 24692000, -101.34),
new
CountryProva(
"Paraguay"
, 6725000, -65.25),
new
CountryProva(
"Turkmenistan"
, 5663000, 58.78),
new
CountryProva(
"Mongolia"
, 3027000, -65.25),
new
CountryProva(
"Japan"
, 127000000, -478),
new
CountryProva(
"Bulgaria"
, 7128000, -101.34),
new
CountryProva(
"Chad"
, 14450000, -101.34),
new
CountryProva(
"Netherlands"
, 17020000, -101.34)
};
}
}
public
class
CountryProva
{
public
CountryProva(
string
name,
double
population,
double
gdp)
{
Name = name;
Population = population;
Gdp = gdp;
}
public
string
Name {
get
;
set
; }
public
double
Population {
get
;
set
; }
public
double
Gdp {
get
;
set
; }
}
If you have any further questions or problem with this,
open a support ticket and we'll investigate further.
Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items