c# - Set focus on the selected item when tabbing in a WPF ListBox -


i have listbox in xaml file looks this:

<listbox name="collateralpledgedlistbox"           style="{staticresource usb_listbox}"           margin="0,0,5,39" width="auto"            itemspanel="{staticresource usb_listbox_itemplacement}"            tabnavigation="local"            itemcontainerstyle="{staticresource usb_listboxcontainer}"            itemssource="{binding model.collateralpledgedbymarriedindividuals, mode=twoway}"            itemtemplate="{staticresource usbcollateralcolsumcolinfodatatemplate}"            scrollviewer.horizontalscrollbarvisibility="hidden">  </listbox> 

this listbox shows vertical scroll bar when there number of rows exceed provided space. not able show selected row user while tabbing through controls within listbox.

i using c# language. on appreciated.

sounds have set focus , refresh view. have tried doing this answer suggests?

private void button_click(object sender, routedeventargs e) {   mainlistbox.selecteditem = mainlistbox.items[3];   mainlistbox.updatelayout(); // pre-generates item containers    var listboxitem = (listboxitem) mainlistbox       .itemcontainergenerator       .containerfromitem(mainlistbox.selecteditem);    listboxitem.focus(); } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -