accept numbers with % (percent) in datagrid editing

  • Thread starter Thread starter Luther Miller
  • Start date Start date
L

Luther Miller

What do I need to do in order to allow the user to enter "10%" in a data
grid column and have it be accepted? I have the numbers displaying this way
with the format property without any issues, however, "10" become "1000%"
and ".10" becomes "10%". I also need to allow users to enter "10%", which is
currently not accepted.

I am guessing I have to derive from DataGridTextBoxColumn and override
something, maybe Commit, and then parse out the % myself and manually adjust
the value by 100 if the % was there. I'd like to make this farily generic -
so am I on the right track with Commit? I can get the entered value from
TextBox.Text, but how can I find out the System.Type of the column? (It
could be decimal, float, etc.). What other steps do I need to take to
implement this correctly?

Thanks
 
Back
Top