WPF ListBox setting focus to first item after losing focus -


problem: i'm having trouble managing focus , item selection in wpf listbox embedded listbox , custom selection management in code behind.

background: "parent" listbox assigned datatemplate containing "child" listbox. have added code navigate using , down arrow keys parent listboxitem child items , child items parent items.

when navigating parent item not first item in first level list box focus set first item , selected though set in program non-first item (e.g. parent item #2). have traced through code , focus , selection set non-first item event select , set focus first item received.

there case on stackoverflow similar experiencing. case wpf listview lost focus tried of answers , responses in case , none of them worked.

does have insight why can't programmatically select non-first element in parent listbox?

try using listbox.issynchronizedwithcurrentitem = true working list's collection view (if you're not explicitly creating one, can use collectionviewsource.getdefaultview) set current item (icollectionview.movecurrentto()).

selectors have more preferable method of dealing selected items when working collection view, rather selecteditem.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -