Hello all,
I am trying to bind an UnBound column of type Checkbox which is displayed as an IMAGE. However, after binding, i cannot view the image. The column appears as white empty cell. However, the column works properly as a checkbox when i click on that empty cell. Here is the code that i wrote that adds the unbound column.
//--------------------------------------------------------//ADD DELETE Column in the beginning.//--------------------------------------------------------if (!ugProcedures.DisplayLayout.Bands[0].Columns.Exists("Delete")){ ugProcedures.DisplayLayout.Bands[0].Columns.Insert(0, "Delete");
ugProcedures.DisplayLayout.Bands[0].Columns[0].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox; ugProcedures.DisplayLayout.Bands[0].Columns[0].DataType = System.Type.GetType("System.Byte[]"); // true.GetType(); ugProcedures.DisplayLayout.Bands[0].Columns[0].Header.Caption = "Delete"; ugProcedures.DisplayLayout.Bands[0].Columns[0].Header.VisiblePosition = 0; Infragistics.Win.EmbeddableImageRenderer imgEditor = new Infragistics.Win.EmbeddableImageRenderer(); Bitmap bmpCellImage = Properties.Resources.deleteButton; imgEditor.DefaultImage = bmpCellImage; imgEditor.ScaleImage = Infragistics.Win.ScaleImage.Never; //imgEditor.ScaleImage = Infragistics.Win.ScaleImage.Always; ugProcedures.DisplayLayout.Bands[0].Columns[0].Editor = imgEditor; } else { if (ugProcedures.DisplayLayout.Bands[0].Columns["Delete"].Header.VisiblePosition != 0) { ugProcedures.DisplayLayout.Bands[0].Columns["Delete"].Header.VisiblePosition = 0; } ugProcedures.DisplayLayout.Bands[0].Columns[0].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox; //ugProcedures.DisplayLayout.Bands[0].Columns[0].DataType = true.GetType(); ugProcedures.DisplayLayout.Bands[0].Columns[0].Header.Caption = "Delete"; ugProcedures.DisplayLayout.Bands[0].Columns[0].Hidden = false; }
Thanks in Advance.
Scott.
Hi Scott,
I was experiencing the same issue with images in CheckBox columns in a grid.
I think it can be resolve just by setting the "CheckAlign" to "MiddleRight" OR the image align to the right (but not both at same time or you will reproduce the same case).
To set the "CheckAlign" of the CheckBox styled column you have to cast the UltraGRidColumn.EditorResolved to CheckEditor and the "CheckAlign" property will be available.
I was trying to set images in a such column and I discovered the check box was hiding the image in fact.
I am looking for a more beautiful HMI solution than this one because if you have a large column the check box and the image will be at the opposites sides of the cell.
Hope this helps.
Regards.
Okay, I think I understand what you are describing here, but I'm not sure what your question is. Do you have this working as you described? Or are you stuck?
If you want to allow the user to click on a cell in a row and delete that row, then the most obvious thing to do would be to set the Style on the column to Button and then handle the ClickCellButton event of the grid.
To put an image on the button, you would use the column's CellAppearance.Image.
Not sure where a CheckBox comes into this... unless you are talking about just marking the row or rows first and then clicking some button outside the grid to delete them all.
Hi Mike,
I apologize for expressing it that way.
The columns are bound by BindingSource control. There is one extra column which I am ADDING after the grid is bound and it shows up as an IMAGE. This image is always the same no matter you click on it or perform mouse events.
When you click on this image cell, It asks for the entire row to be deleted. Clicking OK will delete it. Thats the only thing it does. Please specify if this helped to understand the issue. Thanks again.
I'm not really clear on what you are trying to do here.
iamscotthetfield said:I am trying to bind an UnBound column of type Checkbox which is displayed as an IMAGE.
You can't bind an unbound column. That's a contradiction. A column is either unbound or bound, it will never change from one to the other.
If you just want to change the standard checkbox glyphs into images, then there are a couple of ways you can do it.But how you go about it depends on what you want. Do you want to do this for all CheckBoxes in your application, or just for a single column in the grid?
Do you just want to specify an image for true and another for false? Or do you want to control the image in every state, such as MouseOver, MouseDown, Indeterminate, etc?