Hello,
In xamdatagrid, On click of a button, I need to convert all 0(int,double and decimals) into blank . To implement this i created a style in C# and set ValueToTextConverterProperty and changes it value into the converter as per the cell value but it's not updating the value in the grid.
If column contains 0.00 then it converts to 0 otherwise it's retaining it's old value.
//Code I've written to set ValueToTextConverterProperty :
Style appliedStyleOnSelectedField = SelectedField.Settings.EditorStyle; //Selected field is the column of xamdatagrid
var newSetter = new Setter(ValueEditor.ValueToTextConverterProperty, new ZeroToBlankConverter());
appliedStyleOnSelectedField.Setters.Add(newSetter); SelectedField.Settings.EditorStyle = appliedStyleOnSelectedField ;
Anyone know why is this behaving so weird ?
I have been looking into your post and it seems that you have not set a style for the EditorStyle. This is why it is null. I have create a sample application(DataGridValueToTextConverterProperty.zip) where I have achieve the desired dictionary.
If you need any further assistance on this matter, feel free to ask.
I tried your solution but it only removes 0 after decimal point. I tried to edit your values to 0.00 in the grid itself and then clicks on button1 but value i see in the grid is 0 only.
I did some modifications after that in your converter and tried to return value ( 5, string.empty and null) but it always removing 0 after decimal point. E.g if i am returning value string.Empty or return 8 then it must set empty / 8 value in all rows of the grid. It's not doing that Can you please explain what exactly ValueToTextConverterProperty does ?
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return string.Empty;
}
Looking for your reply