Xceed DataGrid SelectedItem issue

Posted by Patrick K on Stack Overflow See other posts from Stack Overflow or by Patrick K
Published on 2010-04-19T20:20:18Z Indexed on 2010/04/19 20:23 UTC
Read the original article Hit count: 923

Filed under:
|
|
|
|

In my project I have an Xceed data grid which is bound to a data source with many records and record details. I am attempting to create a context menu option that will allow the user to search for a specific detail in a specific column. While I have successfully completed the functionality there is a UI part that is giving me some trouble, in that when I select the row in C#, if that row is not in view the row is never focused on. Thus the user has to scroll up and down looking for the row with expanded details.

I am able to set the SelectedRow and expand the details like so:

this.grid.AutoFilterValues[userColumn].Clear();
this.grid.AutoFilterValues[userColumn].Add(userValue);
if (this.creditLinesDataGridControl.Items.Count > 0)
{
    this.grid.SelectedItem = this.grid.Items[0];
    this.grid.ExpandDetails(this.grid.Items[0]);
}
else
{
    MessageBox.Show("Value not found in column: " + userColumn);
}
this.grid.AutoFilterValues[userColumn].Clear();

where userColumn and userValue are set previously in the method.

How can I make the grid focus on the row after I've set the SelectedItem and expanded the details?

Thanks,

Patrick

© Stack Overflow or respective owner

Related posts about xceed

Related posts about xceed-datagrid