I want to intercept cell paint event to display a diferent text from a cell value.
I want cells that contains numeric or string value and show formated text depend of this value.
I would like cells tha contains '1:3:7:8:' value and print in cell 4 items selected.
Why Cell.Text is readonly?
Why 'Value' and 'Text' can't be different ?
Thanks in advance.
There are a number of ways you can do this.
1) You could use an unbound column. Hide the real column and use InitializeRow to copy the value to/from the real column.
2) You could use a DataFilter. This will only work if you can convert both ways to and from the displayed text and the value.
3) You can use a CreationFilter to set the text on the TextUIElement in the cell. This won't work if the field is editable.
In my scenario I use a cellbutton and open another Form with an SQL Sentence that I stored in a Cell Tag Property.
In a ClickCellButton event I obtain a result and try set Cell Value to SQL result that bounds in a UltraGrid.Datasource(), but I would like to show other text. My fields aren't aditables because have a CellButton style.
The way 1 that you porpose may be a solution but you can write a little peace of code for others?
I never uses a DataFilter and CreationFilter.
Thanks Mike.
There are samples of DrawFilters and CreationFilter in the Infragistics Knowledge Base.
Also, if you are going to try to use one of those, I recommend that you download the Infragistics UIElementViewer Utility. It's a big help when working with UIElements.
Anyway, though, if the cell is a Button, that makes things much easier. I would use an unbound column. Hide the real column of data by handling the grid's InitializeLayout event. In the same event, you can add an unbound column and set it's Style to Button. Then you handle the InitializeRow event and simply copy the value of the real cell into the button cell and you can modify it any way you want.