Reputation: 189
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
Upvotes: 3
Views: 4213
Reputation: 9248
I do not know the Xceed DataGrid's API, but typically such classes provide a method like ScrollIntoView(...)
. After googling a bit, I found that Xceed's DataGrid obviously offers a method called BringItemIntoView(...)
. Did you try that one?
For example, in this thread in the Xceed forum they discuss this method.
Upvotes: 3