This is a migrated thread and some comments may be shown as answers.

RadGridView supports only unique hashcodes

2 Answers 90 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paweł Polaczyk
Top achievements
Rank 1
Paweł Polaczyk asked on 18 Jun 2013, 01:35 PM
I am using an editable RadGridView to present a collection of items of a class, which overrides the GetHashCode method in a way that hash codes are not unique. The problem is that in such a case changing property values from code is not reflected in grid cells. The problem is gone when hash codes are unique. 

I found a forum post from 2011 which says that GridView does not support items with non-unique hash codes.
My question is: Has it been fixed already? Is it planned to be fixed?
I perceive it as a bug, having in mind a rule that equal items have the same hashes, but equal hashes don't determine that objects are the same. I think that the grid should handle items with the same hash code properly.

---------------------------------------------------------------------------------------------------------

Some more details about my problem:

I simplified my class to the following one:
public class Entry : PropertyChangedBase
{
    private string name;
 
    public string Name
    {
        get
        {
            return this.name;
        }
        set
        {
            this.name = value;
            this.NotifyOfPropertyChange(() => this.Name);
 
            this.description = "new content of a description cell";
            this.NotifyOfPropertyChange(() => this.Description);
        }
    }
 
    private string description;
 
    public string Description
    {
        get
        {
            return this.description;
        }
        set
        {
            this.description = value;
            this.NotifyOfPropertyChange(() => this.Description);
        }
    }
 
    public override int GetHashCode()
    {
        return 145;
    }
}

So behaviour of this class is the following:
- changing the Name column should also change the Description column
- hashcodes for multiple items may be the same

However, a grid which is bound to a collection of such items doesn't work as expected. After editing a Name column, the Description property gets updated, but the change is not visible in the grid. The Description cell gets updated only when I click on the cell and open its editor.

2 Answers, 1 is accepted

Sort by
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 18 Jun 2013, 02:08 PM
Hi,

It seems that you've hit a bug in our control and the issue will be fixed with the next internal build (Monday 24 June).

P.S. I've added 1000 Telerik points to your account accordingly.

Regards,
Nedyalko Nikolov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Paweł Polaczyk
Top achievements
Rank 1
answered on 18 Jun 2013, 02:14 PM
That was a quick answer!
Thanks!
Tags
GridView
Asked by
Paweł Polaczyk
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Paweł Polaczyk
Top achievements
Rank 1
Share this question
or