I'm thrashing around in the documentation, forum, and google without success.
I have a flat object containing, among other things, a boolean property. How do I tell an ultragrid that for that boolean property to display an image for true, nothing for false, (instead of the default checkbox)? I want the databinding to be realtime, so if I change the object property and refresh the binding source's currency manager, the display should update accordingly (all that to say I don't want to have to re-initialize the grid every time some data changes).
Should I use an appearance object on those cells? Is the AppearanceImageTypeConverter something I can leverage? Or maybe CellDisplayStyle?
Thanks! (CLR 2.0)
Do you want to do this just for the grid?
For a single Column?
For all grids in your application?
Or for all checkboxes in your entire application both in and out of the grids?
For a single column (bound to a single property) on a single grid. Thanks so much for such a rapid response!
Okay, so if it just for a single column, then what you should do is place an UltraCheckEditor control on your form. You can use the GlyphInfo property on the UltraCheckEditor to control the look of the checkbox glyphs for every state. Then you set the grid column's EditorControl (or EditorComponent if you have the latest version) to the UltraCheckEditor control.
Hi Mike,
I've come across this old posting about using an UltraCheckEditor to display images on a databound Ultragrid and I think ought to solve a requirement that we have. However, I've followed the example through and although I see my UltraGrid column now dispalying a nice red circle to indicate a checked value when in design mode when I build I'm just seeing standard checkboxes again. The Ultragrid is databound to an vb.net Interface and the column should be displaying a bit field. The checkboxes are correctly representing the databound value state so that part's working, it's just not picking up the UltraCheckEditor custom Glyph.Is there something special that needs to be done to the grid to make it display correctly at run-time ?
Do you have some example code to demonstrate this working correctly ?Thanks in advance for you help,cheers
Andy
Hi Andy,
Are you using the single-column approach or the whole-application approach using AppStylist?
My guess is that you are probably doing the single column and you need to turn off themes. try this:
Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout Dim layout As UltraGridLayout = e.Layout Dim band As UltraGridBand = layout.Bands(0) band.Columns("My Checkbox column").CellAppearance.ThemedElementAlpha = Alpha.Transparent End Sub
Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout Dim layout As UltraGridLayout = e.Layout Dim band As UltraGridBand = layout.Bands(0)
band.Columns("My Checkbox column").CellAppearance.ThemedElementAlpha = Alpha.Transparent End Sub
If that doesn't help, let me know and I will see if I can whip up a sample for you.
I've got my filtering appearing correctly using an UltraCheckEditor and setting it's checked / unchecked values to my image (and a default null image).
I've then got my column filtering set so that EditorComponente for this column is set to the UltraCheckEDitor control ID (which comes from a dropdown).
The individual cells now also nicely display the image for check state and vice-versa.
But nothing happens when I set the filter to show a checked image (by clicking on the header).
I thought that the filter would just work - but I'm obviously missing something ! It needs to work client side so not go back to the database as that would default the purpose I think.
The grid datasource is (currently) just a simple DataTable with rows added at run-time for testing purposes and I would have expected the filtering to "just work". The sort ordering by clicking on the column header works fine so it can "see" the data.
Do I need to hook into a change event of the filter and then apply it to the grid or band or *something* !
cheers
Is this column's DataType boolean?
Did the filtering work before you applied the editor/images?
I've removed the custom editor from the grid (so the Col2 EditorComponent is set to (none) and it's still not filtering.
Let me try deleting the grid completely and setting it up from scratch again in case I've set something weird on there that I can spot !
This is only a little test bed to demonstrate some things to our team before I estimate how long it will take to rebuild a form in our application.