Hi,
I have a bound grid. Some columns are of type string. If I enter in such a cell a special character like & " < the Text property contains the string as displayed. However the Value property converts the special characters to & " and the like. Is there an easy way to omit this conversion? I want to have the value of the Value property to be the same as the entered string.
Thanks,
Bettina
Hi Mike,
thanks for the list. I have bound columns and I don't really want to change that. The grids columns are bound to properties of an object. So in the setter of such a property, I check for the escape codes and replace them the the corresponding string. So I'm not messing with the grid, but just interfere at the point the data behind gets a new value. This works really well.
Thanks
Hi Bettina,
I'm not sure I am following you. If you change the escape codes back to normal characters, then they will not display in the grid. In fact, it will cause problems, because your XML will become invalid and the user may see the XML instead of what they typed.
What I would do is leave the FormattedText cell as is and then handle this when you retrieve the value from the cell. So you could make the formatted text cell an unbound column (if it isn't already) and then copy the data from the column into a real bound column and do the conversion along the way.
As for a list of the escape codes, I think there is one somewhere in the documentation, but I'm not sure exactly where. Here's a list, though:
& &
" " &NBSP; or &EDSP;
< <
> >
" "
Unfortunately I found out we can't live with the standard text editor, because we had some troubles with wrapping and scrolling with it. So I now will just manually undo the conversion. Is there somewhere a list that tells me which input will be converted how? I couldn't find any.
(As we use dynamic binding, I can't just bind to a different property - or at least I don't know how that would work)
Thanks and regards
thanks for your answer. I didn't realize that the FormattedTextEditor is supposed to do exactly that (the xml conversion). I removed it and use the standard string editor now it it works.
Thanks a lot for your help
Regards,
If you are using FormattedText, then no, there is no way to prevent this conversion. These special character have to be escaped (converted) because they have special significance to the XML.