Converting a boolean (checkbox) to an image in an ultragrid

Answered (Verified) This post has 1 verified answer | 12 Replies | 5 Followers Thread's RSS feed.

DippyKDog
Points 40
Replied On: Fri, Feb 5 2010 10:34 AM Reply

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)

  • Post Points: 20

Verified Answer

Mike Saltzman
Points 465,595
Infragistics Employee
Answered (Verified) Replied On: Mon, Feb 8 2010 9:24 AM Reply
Verified by DippyKDog

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.

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 40

All Replies

Mike Saltzman
Points 465,595
Infragistics Employee
Replied On: Fri, Feb 5 2010 11:11 AM Reply

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?

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 65
DippyKDog
Points 40
Replied On: Fri, Feb 5 2010 11:42 AM Reply

For a single column (bound to a single property) on a single grid. Thanks so much for such a rapid response!

  • Post Points: 20
Mike Saltzman
Points 465,595
Infragistics Employee
Answered (Verified) Replied On: Mon, Feb 8 2010 9:24 AM Reply
Verified by DippyKDog

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.

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 40
millermp1
Points 10
Replied On: Mon, Aug 9 2010 2:41 PM Reply

Pointers to the other options (e.g. all booleans in a given grid)?

  • Post Points: 5
millermp1
Points 10
Replied On: Mon, Aug 9 2010 2:43 PM Reply

And for the first option, i.e. all columns in grid? Pointers to the others would be welcome, too.

  • Post Points: 5
Replied On: Sun, Nov 8 2015 5:52 AM Reply

Hello.

What should I do, if I want to do this for all grids in my application and what if I want to do this for all checkboxex in my application.

  • Post Points: 20
Mike Saltzman
Points 465,595
Infragistics Employee
Replied On: Mon, Nov 9 2015 9:36 AM Reply

Hi,

To acheive this for your entire application, the easiest thing to do would be to use AppStylist. You could create a Style Library and modify the Glyphs for All Controls.

What you do is open AppStylist and create a new style library (or modify an existing one if you are already using one).

Go to the "Component Role Settings" on the Role tree. Under that, select "All Components."

Down at the bottom you will see the properties that are modifiable for all controls and this includes the CheckBoxGlyphInfo and the RadioButtonGlyphInfo.

So you can modify these and save the isl file, then load that isl file into your application by calling StyleManager.Load and pointing to the filename of your isl file.

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 5
Replied On: Tue, Aug 22 2017 6:49 PM Reply

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

  • Post Points: 20
Mike Saltzman
Points 465,595
Infragistics Employee
Replied On: Mon, Aug 28 2017 9:28 AM Reply

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

If that doesn't help, let me know and I will see if I can whip up a sample for you. 

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 20
Replied On: Wed, Sep 6 2017 2:10 PM Reply

Hi Mike,

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

Andy

  • Post Points: 20
Mike Saltzman
Points 465,595
Infragistics Employee
Replied On: Wed, Sep 6 2017 2:15 PM Reply

Hi Andy,

Is this column's DataType boolean? 

Did the filtering work before you applied the editor/images? 

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 20
Replied On: Wed, Sep 6 2017 6:36 PM Reply

Hi Mike,

  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.

cheers

Andy

  • Post Points: 5
Page 1 of 1 (13 items) | RSS