Hi
I have a Xamgrid WPF control which displays one column bound to a view model. The column is bound to a double type field.
<ig:TextColumn Key="Value" IsReadOnly="False" ValueConverter="{StaticResource PercentConverter}">The percent converter has the following code
double val = (double)value; return val.ToString("P3");
All this works fine. I get the result as expected.
Now, the requirement is that this cell is editable and the users can update values. What is happening is that whenever I double click the cell to edit the cell does not show the converted value (in percentage) but the original value.For eg. if the actual value was 0.0037 after applying the converter the value will be displayed in the grid as 0.37%. What I want is when the user double clicks the cell to edit I want to display 0.37 (without the percentage).
Any help appreciated.
Thanks
This doesn't help either. The value does indeed get displayed in % for eg (0.00375) gets displayed as 0.38% but when I double click and it enters the edit mode the value gets converted into (0.00375).
Chev
Hi,
Actually, I would recommend that you eliminate the converter and just format the text in your TextColumn by using the FormatString. When it goes into edit mode you will see the actual value, unformatted.
It would look like this:
<ig:TextColumn Key="Value" FormatString="{}{0:P}" />
Please let me know if you have any questions.