
I am trying to append units and get custom formatting to work with my DoubleEditBox. To do that, I have tried to implement an IStringValueConverter<double?> to set to the DoubleEditBox so that I can do custom formatting in it.
However, none of my methods are called in my StringValueConverter if I put in the necessary breakpoints.
public class DSVConverter : IStringValueConverter<double?>
{
public DSVConverter()
{
}
#region IStringValueConverter<double> Members
public bool CanConvertFromString(string text)
{
return true;
}
public bool CanConvertToString(double value)
{
return true;
}
public double ConvertFromString(string text)
{
return double.Parse(text);
}
public string ConvertToString(double value)
{
return value.ToString("##.00");
}
#endregion
}
<editors:DoubleEditBox Value="{Binding Height}"
StringValueConverter="{StaticResource dsvConverter}"/>
Could you please help me identify what I am doing wrong? Could you give me a sample on how to make this work?
Thanks in advance
[Modified at 09/08/2011 09:08 AM]
However, none of my methods are called in my StringValueConverter if I put in the necessary breakpoints.
public class DSVConverter : IStringValueConverter<double?>
{
public DSVConverter()
{
}
#region IStringValueConverter<double> Members
public bool CanConvertFromString(string text)
{
return true;
}
public bool CanConvertToString(double value)
{
return true;
}
public double ConvertFromString(string text)
{
return double.Parse(text);
}
public string ConvertToString(double value)
{
return value.ToString("##.00");
}
#endregion
}
<editors:DoubleEditBox Value="{Binding Height}"
StringValueConverter="{StaticResource dsvConverter}"/>
Could you please help me identify what I am doing wrong? Could you give me a sample on how to make this work?
Thanks in advance
[Modified at 09/08/2011 09:08 AM]