tags:

views:

22

answers:

1

Hi ,

wpf datagrid in which will bind to an observable collection of employee details.

Grid will loaded from another screen upon selection of employees by user.If user selecting employee A multiple times same record will loaded in to this grid.

But my problem is when i select employee A and then selecting the same employee A of another row my row selection style is applicable to both records. I set selection mode property of grid to Single.

then also same multiple selection of same record is happening.

Could any one of you please help me out to solve this peculiar issue.

A: 

The issue comes because DataGrid uses Equals() to do the selection. And equals returns true for the same employee.

A possibility is to use wrapper-object a that wraps the your Employee and provides its data. Then the problem will be resolved because the Equals returns only true if the reference is equal (as long as you don't override it).

Google for the MVVM pattern. With this, you will create such wrapper-objects as part of the design.

HCL