Posted 3 September 2018, 7:27 pm EST
Hello Mayur,
Thank you for sharing the application.
Yes, both these are by-design. However, you can workaround them to meet your requirements using a Converter.
- For showing a blank/empty cell when C1NumericBox’s value is set to null, then you need to define Convert method of IValueConverter, as follows:
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return double.NaN;
return value;
}
- To get notified upon pressing Delete key on C1NumericBox, you need to define IValueConverter’s ConvertBack method, as follows:
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if(double.IsNaN(System.Convert.ToDouble(value)))
{
return null;
}
return value;
}
Then in XAML, sjust use this converter while binding C1NumericBox’s Value.
Attached is modified sample application for reference.
Thank you,
Ruchir
Demo_fixed.zip