focus - WPF: Prevent RowDetailTemplate from being entered using down arrow key? -


i have datagrid displays rowdetailtemplate selected row. user can scroll through datagrid using , down arrow keys easily, when user reaches last row in datagrid odd happens: instead of keeping focus on last row enters rowdetailtemplate. wouldn't mind loosing focus in row selection, problem first usercontrol in rowdetailtemplate combobox reacts down arrow key changing selection. have few customers complained changed values in combobox unintentionally, because did not notice focus moved row combobox.

the solution found far set istabstop false, means user cannot use tab key anymore reach said combobox.

does have idea how prevent focus enter rowdetailtemplate via arrow key?

it nice if guys read each other's questions because answered identical question 1 earlier today. take @ answer wpf c# how disbale focus changes arrow keys question more information. however, question different enough stop me closing duplicate.

the principle remains same however... need set e.handled property true in previewkeydown event handler stop normal behaviour (from linked question):

private void textbox_previewkeydown(object sender, keyeventargs e) {     if (e.key == key.left || e.key == key.right)     {         // move camera here         e.handled = true;     } } 

the difference you'd need check if you've got last item before cancel normal behaviour.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -