Hi,
i just created a check editor for a column, with the CheckAppearance.Image and Apperance.Image set to 2 different images and i sent IndeterminateAppearance.Image = null. also i've already set checkEditor.ThreeState = true.
however when the bool? has no value, it still shows the Appearance.Image, why is that?
I encountered this same issue after upgrading to v8.2 and found that the following code will prevent the checkbox from being drawn when the state is indeterminate by using the DrawFilter property on the grid:
grid.DrawFilter = new GridCellDrawFilter(); // the class defined below, for me this is in the contructor of my derived grid class after the InitializeComponent() call
public class GridCellDrawFilter : Infragistics.Win.IUIElementDrawFilter
{
public Infragistics.Win.DrawPhase GetPhasesToFilter(ref Infragistics.Win.UIElementDrawParams drawParams) { if (drawParams.Element is CheckEditorCheckBoxUIElement) { return Infragistics.Win.DrawPhase.BeforeDrawElement; } else { return Infragistics.Win.DrawPhase.None; } }
public Infragistics.Win.DrawPhase GetPhasesToFilter(ref Infragistics.Win.UIElementDrawParams drawParams)
if (drawParams.Element is CheckEditorCheckBoxUIElement) { return Infragistics.Win.DrawPhase.BeforeDrawElement; } else { return Infragistics.Win.DrawPhase.None; }
if (drawParams.Element is CheckEditorCheckBoxUIElement)
return Infragistics.Win.DrawPhase.BeforeDrawElement;
}
else
return Infragistics.Win.DrawPhase.None;
public bool DrawElement(Infragistics.Win.DrawPhase drawPhase, ref Infragistics.Win.UIElementDrawParams drawParams) { CheckEditorCheckBoxUIElement chkEditorElement = drawParams.Element as CheckEditorCheckBoxUIElement; if (chkEditorElement == null) return false; if (chkEditorElement.CheckState == CheckState.Indeterminate) return true; // returning true indicates that this phase has been handled and the default processing should be skipped return false; }
public bool DrawElement(Infragistics.Win.DrawPhase drawPhase, ref Infragistics.Win.UIElementDrawParams drawParams)
CheckEditorCheckBoxUIElement chkEditorElement = drawParams.Element as CheckEditorCheckBoxUIElement; if (chkEditorElement == null) return false; if (chkEditorElement.CheckState == CheckState.Indeterminate) return true; // returning true indicates that this phase has been handled and the default processing should be skipped return false;
CheckEditorCheckBoxUIElement chkEditorElement = drawParams.Element as CheckEditorCheckBoxUIElement;
if (chkEditorElement == null) return false;
if (chkEditorElement.CheckState == CheckState.Indeterminate) return true; // returning true indicates that this phase has been handled and the default processing should be skipped
return false;
You could do that, too. But personally, I think it's a lost easier to just assign a blank image.
Sorry, I forgot to mention in my first post that I attempted that solution first without success. When I supplied a solid red (for contrast) System.Drawing.Bitmap object (32x32), the portion of the cell from top to bottom and from the left edge of the cell to the right edge of the check box (not the cell) was filled in red. However, the default check box image was still visible on top of this. Changing the ImageAlpha property only affected the red image and not the check box image.
Is the IndeterminateAppearance.Image property supposed to be set to a new System.Windows.Controls.Image object? (Due to an unrelated issue I am unable to access that namespace in order to test this)
Hm. Okay, I have been working under the assumption that you wanted to replace all three states of the checkbox indicator with images. But if you are using the normal checkbox indicators and you want to blank out just one of them, then you need to use a DrawFilter or CreationFilter for that.
Unless you are using v8.2 or up, in which case you can use the GlyphInfo property to modify the images of any state directly.
You can't apply an image to a grid row, only to a cell. So you will need to add a column to your grid to display the image.There are a number of ways you can do this. You could add a column to the data source. You could add an unbound column to the grid. The column's DataType could be Image or Bitmap and you could set the value of the cell to an image value in the InitializeRow event or the AfterRowExpanded/AfterRowCollapsed events. Or you could use an Appearance.Image for the cell instead of an image value.
hi Mike,
i want to set the image to the grid roe.i.e when the row executed i want to show openmailbox image and if not closed mailboximage.give me an idea how to setup the image dinamically to a grid row?