views:

20

answers:

1

Hi Guys,

I am using Silverlight 4 DataGrid with DataPager.

When the DataGrid's ItemsSource is set, it selects the first row in the list.

PagedCollectionView _list = new PagedCollectionView(myDataCollection);
_dataPager.Source = _list;
_dataGrid.ItemsSource = _list;

The problem is that I have _dataGrid.SelectionChanged event, which I want to fire only when users makes a selection change. But it is firing that event because datagrid defaults select to the first item.

I would either switch the event to leftMouseButtonDown, but that also does not work very well. Any suggestions?

Thanks,

Voodoo

A: 

Try setting "DataGrid.IsSynchronizedWithCurrentItem" to false. I bet it has something to do with this. Since you're using a CollectionView, the selected item in the DataGrid will be in sync with the CollectionView's CurrentItem, which automatically gets set to the first item when the CollectionView gets initialized.

karmicpuppet