General information
Category:
Windows Presentation Foundation (WPF)
>I have a datagrid in a WPF form. The datagrid is bound to a collection of employees.
>
>When the form loads, I know that I want to set the current row of that datagrid to a certain employee's record based on that employee's ID.
>
>I find the employee record by doing:
>
> var e = DBContext.Employee.Where(x=>x.EmployeeID == empID).First();
>
>How do I set the datagrid's current row to this employee's record and set focus on the datagrid?
Assuming that the DataGrid is bound to DBContext.Employee then all that should be neccessary is:
theDataGrid.SelectedItem = e;
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only