Is it possible to use the UltraFormattedTextEditor to handle its value as raw text i.e. if I set "A B" as a value for a cell the grid displays this as exactly as "A B" (three spaces between A and B)? My current tests show that the spaces are always condensed in the display (although the value continues to have the three spaces).
The documentation here talks about a possibility to use the TreatValueAs enum to indicate that the values should be considered as raw text - however, the enum only as FormattedText, URL and Auto. None of these seem to assume raw text.
You might argue that I could use UltraTextEditor instead of UltraFormattedTextEditor but in fact that editor behaves very different regarding focus handling and various other things that we are currently discovering after I replaced UltraFormattedTextEditor by UltraTextEditor.
So ideally I can make UltraFormattedTextEditor behave like UltraTextEditor regarding how it translates text to value and vice versa.
Can that be done?
You can either open the Value Editor and edit the value as A B(three spaces between A and B) or enter A&edsp;&edsp;&edsp;B into Value property to get the expected result like in the screenshot.
Well, the use case is more like:
- I bind the grid to some data source
- the data source knows nothing about the formatting (so no &edsp; values will be in the string)
- nevertheless I want the data to be displayed as in the data source (3 spaces)
- when I enter values with spaces into the grid I want them in the data without any formatting decoration (text as is)
What I found out today is:
- if TreatValueAs is set to Auto it works in this direction (bound data is properly rendered in the cell)
- if I set the UpdateMode of the grid to OnCellChange values entered in the editor are transferred correctly (for my use case) into the bound data
This looks all pretty unexpected to me but in the end I have what I need.
Sounds weird doesn't it? The problem is that the grid is in use since a while and initially (year ago) someone chose to use UltraFormattedTextEditor (because he/she considered to make use of the formatting capabilities at some time). We recently discovered the "side-effects" of this control and attempted to replace it with the plain UltraTextEditor. However, that is not a simple drop-in replacement - at least not with all the additional event handlers and/or overrides we have added on top. We discovered a range of issues after the replacement (pasting values in a cell behaved different, content in multiline cells was no longer vertically centered and focus handling seems to be different, too). Each of these problems can probably be solved one-by-one, but that is just too risky now. For a new application I for sure just would have switched to UltraTextEditor.
Out of curiosity... if your data does not contain any formatting and doesn't know anything about the formatting... why are you using FormattedTextEditor in the cell?
Even though the /// comments for TreatValueAs is a bit misleading , I am glad that you found solution to it.
Please let me know if I can provide you any further assistance.
Thanks,Josheela