Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
330
Checkbox changing to an image when "hidden"?
posted

Hey guys,

I'm trying to add a bit of glam to our app... in particular...

We have a grid with some rows having a checkbox.  Some rows are not to be tickable though.  I can hide the cell in InitializeRow with:-

e.Row.Cells["Assigned"].Hidden = true;

However... customers will be all "Heyyy, why cant I tick this row?".  So the plan is to put an icon in it, and show what the icon means outside the grid.

My initial thought was to get the actual CheckBox object within the cell and set that to hidden, then set the .Image for the cell... but I can't figure how to get the actual CheckBox, rather than the cell.

Can anybody help?

Parents
  • 469350
    Verified Answer
    Offline posted

    There are a number of ways to do this. One way would be to use a CreationFilter and replace the CellUIElement with an ImageUIElement.

    CreationFilters can be a little daunting if you have never used them before, but they are very powerful and worth the time it takes to learn. If you want to try that approach, I recommend checking out the Infragistics Knowledge Base for sample CreationFilters. Also, get the Infragistics UIElementViewer Utility. It's a big help when dealing with UIElements. If you have any questions about this approach, I will be happy to try to help.

    If you want to take the more mundane approach, you can use an editor. Here's what you do:

    • Add an UltraCheckEditor to the form with the grid.
    • Set the Style of the CheckEditor to Custom.
    • Assign the Appearance.Image to the image you want displayed on the"uncheckable" cells. This assumes the Value of the cell will return an unchecked state. If not, you might also want to set CheckedAppearance.Image and IndeterminateAppearanc.Image to the same image.
    • Now instead of hiding the cell, just set the EditorControl property of the cell to the UltraCheckEditor with the image and set CellActivation to disable the cell.
Reply Children
No Data