Hi,
We have an issue with a custom column we used in RadGridView.
There is a scenario when a column, hence a whole row is not selectable. Please see the attached sample solution and follow below scenario:
1. Scroll to Col5 which is editable,
2. Edit Col5 value
3. Click a column next to Col5 in the same row (to accept the value in Col5 cell),
4. Scroll to the left to see Id column
5. Select the row by clicking on Id cell In the same row.
The issue is that the row is not possible to be selected nor the checkbox in the column is ticked.
Can you advise?
Thanks,
Łukasz
The selection in GridView relies partially on the the mouse events of the GridViewCell elements. Setting IsHitTestVisible to False (in the CreateCellElement override in this case), prevents the mouse events to be thrown for this element, thus the selection won't work until the current row is changed.
To resolve the issue avoid setting IsHitTestVisible to false. Also, if you tell me why do you need this, I can think of some alternative ideas.
Hi, I could remove it, as it is a workaround for disappearing checkbox in the custom column, but then there is another issue.
Try clicking multiple times the cell of the custom column where the checkbox is located. the checkbox will disappear after some amount of clicks.
Can you advise?
Hi,
Have you seen my response? Can you provide any update?
Thanks,
Łukasz
I was able to reproduce the described behavior, but I am not sure if this is the same issue on your side. The number of clicks didn't matter on my side. Instead, the checkbox disappears if I click near the borders of the cell. For example, when I click on the bottom border. This happens because the cell has two visuals - one for the normal state and one for the edit state. When you click outside of the checkbox (near the border), the cell enters edit mode, which is why the checkbox is replaced by a default empty editor. If this is the same issue as the reported one, then you can avoid it by disabling the editing of the cells in the CustomColumn.
So, you can set IsHitTestVisible to True (or not setting it at all, because True is the default value) and then set the EditTriggers of the column to None.
public CustomColumn() : base() { EditTriggers = GridViewEditTriggers.None; }
Edit: Unfortunately, after the change when I click the checkbox/cell with checkbox, it still does disappear.
See the updated solution
The issue is the same as you described. The scenario is as follows:
1. Edit value in Column 5,
2. Click the cell in Column 6 in the same row to accept the new value in Column 5,
3. Click the border of checkbox cell in the same row,
4. The checkbox disappears
Thank you for the steps. Based on them, I've managed to recreate the issue. An alternative solution that seems to work here is to override the CanEdit method of the column and return false.
public class CustomColumn: GridViewBoundColumnBase { public override bool CanEdit(object item) { return false; } // other code here }