I've opened mscorlib in ILSpy and I see in resources folder:
Name, Value
[Format_InvalidString, Input string was not in a correct format.]
Is there any way to localize this string?
(Context: silverlight app throws this message whenever incorrect number is entered and it would be much easier to just change this than to write converter and apply it in hundreds of places).
The only solution that works is this:
public partial class MyEntity
{
public string MyField_string
{
get
{
return MyField.ToString();
}
set
{
decimal res = 0;
var b = Decimal.TryParse(value, out res);
if (!b)
throw new ArgumentException("Localized message");
else
this.MyField = Math.Round(res, 2);
}
}
partial void OnMyFieldChanged()
{
RaisePropertyChanged("MyField_string");
}
}
And then bind to MyField_string
instead of MyField
.