Repro-steps:
Expected behavior:
Observed behavior:
I traced the problem back to the method GridViewSleectedCellsCollection.IsSelected / GetHashCodeString.
internal bool IsSelected(GridViewRowInfo row, GridViewColumn column) => row != null && column is GridViewDataColumn && this.hashtable.Contains((object) this.GetHashCodeString(row, column));
When a cell is selected with GridViewCellInfo.IsSelected = true, it checks if it has already been selected. It does so by calling GridViewSleectedCellsCollection.IsSelected. which checks if a HasCodeString is already in a hashtable. But, when another selected cell has the same HasCodeString, the result is (incorrectly) true, which will result in not added it to the collection of selected cells.
I guess that is can be easily fixed by changing:
private string GetHashCodeString(GridViewRowInfo row, GridViewColumn column)
{
int hashCode = row.GetHashCode();
string str1 = hashCode.ToString();
hashCode = column.GetHashCode();
string str2 = hashCode.ToString();
return str1 + str2;
}
to:
private string GetHashCodeString(GridViewRowInfo row, GridViewColumn column)
{
int hashCode = row.GetHashCode();
string str1 = hashCode.ToString();
hashCode = column.GetHashCode();
string str2 = hashCode.ToString();
return str1 + "_" + str2;
}
Since hashcodes 1 + 23 will result in the same string as hashcodes 12 + 3.
Making this change will reduce the problem significantly, but not entirely since hashCodes will never be unique.