views:

6

answers:

0

I'm trying to give focus to a DevExpress GridControl on display of the window, so that when the window displays, the user is just able to press arrow keys to navigate the list. I'm using FocusManager.FocusedElement to focus on the GridControls TableView when the page loads, and sometimes it works, but othertimes, I found the usercontrol added before the GridControl gets focus and sometimes focusedElement is NULL (Snoop tells me this). I've then tried hooking into the Loaded event on the window and tried setting the focus there, but still getting this inconsistent behavior. I then tried hooking into the PreviewLostKeyboardFocus event on the TableView within the GridControl and setting the KeyboardFocusChangedEventArgs.Handled to True, which made no difference - I then also tried hooking into the LostKeyboardFocus event of the TableView and setting focus to the TableView, but still, the same behavior. Can anyone give me an idea as to what could be the issue and what I could do to fix this. Greatly appreciated.