Hello I am attempting to add a behavior to an entry within my Xaml which will add commas to the numbers that are placed within the field. I have tried quite a few solutions and when adding the code below I am no longer able to build the project for IOS. The code below requires the addition of the Mono.Android.Dll, which has proven to be the culprit? The ( DecimalFormat df = null ) and subsequent uses are in error. The errors disappear when adding the Mono.Android.dll. but the behavior noted above is caused by the addition of the dll. Can someone help me with this issue or provide a workaround please? Thank you
public static String dataFormat(String text)
{
DecimalFormat df = null;
if (text.IndexOf(".") > 0)
{//include decimal
if (text.Length - text.IndexOf(".") - 1 == 0)
{//include a decimal
df = new DecimalFormat("###,##0.");
}
else if (text.Length - text.IndexOf(".") - 1 == 1)
{//include two decimals
df = new DecimalFormat("###,##0.0");
}
else
{//include more than two decimal
df = new DecimalFormat("###,##0.00");
}
}
else
{//only integer
df = new DecimalFormat("###,##0");
}
double number = 0.0;
try
{
number = Double.Parse(text);
}
catch (Exception e)
{
number = 0.0;
}
return df.Format(number);
}
}
}