wpf - how to get the correct index in a datGrid when I use the MVVM pattern and I have a filter in the dataGrid? -
i have datagrid in view, , select row. in view model have property bind selectedindex of datagrid.
when add new row datagrid, element add @ end of elements, show in datagrid can see in last position.
however, if have shorted elements in datagrid because click in column name , filter makes new element in first position of datagrid, select incorrect element, because internally position of new element in n position, not first.
for example. have table has name , username of people. persons in datagrid , short them name. insert new person name aaaa. when add new person, in datagrid can se person in first row, select last person because in view model select index of new person, internally add @ end.
how can select in datagrid correct row when have used filter?
thanks.
you use icollectionview handle selecteditem
this._myview= collectionviewsource.getdefaultview(this.mysourcecollection); ... this._myview.movecurrentto(newitemwithaaaa); then new element selected
Comments
Post a Comment