WPF Datagrid select new row

Dec 10, 2009 at 6:37 PM

I have a datagrid that is bound to a data view through a dataprovider.

<code>

MyDatagrid.ItemsSource="{MyDataViewDataprovider}"

</code>

 When I add a row I can easily select the row through the code and continue working. 

<code>

MyDataView.Table.Rows.Add(MyDataTable.NewRow())

MyDatagrid.Updatelayout

MyDatagrid.SelectedIndex = MyDatagrid.Items.Count  -1

MyDatagrid.ScrollIntoView(MyDatagrid.SelectedItem)

</code>

For some reason I can't seem to do this if i've filtered the data view.  By looking through the items collection I can tell that the item exists but I can't set that item as the selected item. 

 

I