I tried to set the new added row as the selected row, but have some strange effects.
In the grid I have set IsSynchronizedWithCurrentItem to true, because I want the arrow to follow the selected row (currentItem).
Also set the ShowInsertRow to true.
After the user has clicked on that row, filled in his information and presses the Enter key, I'd like to set this newly added row as the selected row with the Arrow (IsSynchronizedWithCurrentItem) also set to this row.
With AddingNewDataItem I create the new item with default values.
In the RowEditEnded I add this new object to the ObjectContext, save the changes in the context and do the following check:
Then I have the ScrollIntoView function:
It looks like it's working, but I still have the previous selected row ALSO having the Arrow mark. When I select a different row the newly selected row get the arrow mark, but my new added row keeps also having the arrow mark.
I need to select the new added row then select a different row to have it all working.
What's wrong here? Using WPF Q1 2012.
In the grid I have set IsSynchronizedWithCurrentItem to true, because I want the arrow to follow the selected row (currentItem).
Also set the ShowInsertRow to true.
After the user has clicked on that row, filled in his information and presses the Enter key, I'd like to set this newly added row as the selected row with the Arrow (IsSynchronizedWithCurrentItem) also set to this row.
With AddingNewDataItem I create the new item with default values.
In the RowEditEnded I add this new object to the ObjectContext, save the changes in the context and do the following check:
if
(e.Row
is
GridViewNewRow)
{
ScrollIntoView(grdDataGrid, e.Row.Item);
}
Then I have the ScrollIntoView function:
private
void
ScrollIntoView(RadGridView grd,
object
itmSel)
{
grd.SelectedItem = itmSel;
grd.ScrollIntoViewAsync(grd.SelectedItem, r =>
{
var row = r
as
GridViewRow;
if
(row !=
null
)
{
row.IsCurrent =
true
;
row.IsSelected =
true
;
row.Focus();
}
grd.CurrentItem = itmSel;
grd.CurrentCellInfo =
new
GridViewCellInfo(grd.SelectedItem, grd.Columns[0]);
});
}
It looks like it's working, but I still have the previous selected row ALSO having the Arrow mark. When I select a different row the newly selected row get the arrow mark, but my new added row keeps also having the arrow mark.
I need to select the new added row then select a different row to have it all working.
What's wrong here? Using WPF Q1 2012.