Set focus to datagrid from treeview
I'm attempting to set the focus to a datagrid after a selection has been made in a treeview. I'm capturing the correct value in the treeview, and making a decision based on that value, so things are working to that point. Now I simply want to set focus to a datagrid, any row, any column. In the past I've had to use a delegate, but I'm unclear if this is true in WPF. Seems simple, but so far the solution is elusive.
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Mar 13, 2012, 12:02 PM EDT
For that to work the Focusable property needs to be set to true which should be the case anyway.
Ron44 reputationPosted Mar 13, 2012, 12:15 PM EDT
VulpesRank #55 · 29.2K reputationPosted Mar 13, 2012, 12:23 PM EDT
So, I'd try something like:
bool isSuccess = dataGrid1.Focus();
Ron44 reputationPosted Mar 13, 2012, 12:43 PM EDT