I'm using an editable DataGridView
Windows form to display a list of variables which can have different types of information, the format of which is unknown to the application: paths, strings, numbers, and so on. The form is using source data binding.
Some of the values may be long, and I would like to display them on several lines rather than a long, partially visible line. The original WrapMode
is not appropriate in my case because it splits the lines on space characters, which are not always present: typical examples are a long PATH variable made up of semi-colon-separated paths, or hex digits.
Wrapping lines at the form border rather than on specific characters would be fine, though only doing that if necessary would be better. Adding other split positions, instead of space characters, only would be even better.
Performance-wise: the grid row count will never be very high: usually 0 to 10, could go as high as, say 50, in some extreme cases, and normally the maximum length of each shouldn't be more than 4 or 5 lines when wrapped. So it's not a big concern.
How would you recommend to do that?
- handling the
CellFormatting
event, by inserting\r
characters and removing them when parsing the committed value? The problem with this is that the cell seems to have its own way of re-formatting the text in input mode, changing its aspect when switching between the two modes. Possibly other side-effects yet to be discovered... - or is there a way to modify the
WrapMode
behaviour that I overlooked?