.net - C# SilverLight. The tab key does not change focus for the text boxes -
i have got little problem.
i use listbox control textboxes.
i set focus on first textbox , try jump on following textbox key tab. not work.
what wrong?
thanks in advance!
<listbox name="box" scrollviewer.horizontalscrollbarvisibility="disabled" background="transparent" borderthickness="0"> <listbox.itemcontainerstyle> <style targettype="listboxitem"> <setter property="template"> <setter.value> <controltemplate> <stackpanel orientation="horizontal" margin="40,2,0,2"> <textblock text="{binding label}" minwidth="20" /> <textbox tabindex="{binding index, mode=oneway}" text="{binding information, mode=twoway}"/> </stackpanel> </controltemplate> </setter.value> </setter> </style> </listbox.itemcontainerstyle> </listbox> namespace silverlightapplication1 { public partial class mainpage : usercontrol { public mainpage() { initializecomponent(); var model = new list<model>() { new model() {index = 1, label = "1"}, new model() {index = 2, label = "2"}, new model() {index = 3, label = "3"}, new model() {index = 4, label = "4"} }; box.itemssource = model; } } public class model { public int index { get; set; } public string label { get; set; } public string information { get; set; } } }
you'll need specify in style how want tabs work. shouldn't need bind tabindex, unless want change order tab works in. think should work similar trying do:
<listbox name="box" scrollviewer.horizontalscrollbarvisibility="disabled" background="transparent" borderthickness="0"> <listbox.itemcontainerstyle> <style targettype="listboxitem"> <setter property="template"> <setter.value> <controltemplate> <stackpanel orientation="horizontal" margin="40,2,0,2"> <textblock text="{binding label}" minwidth="20" /> <textbox text="{binding information, mode=twoway}" /> </stackpanel> </controltemplate> </setter.value> </setter> <setter property="istabstop" value="false" /> </style> </listbox.itemcontainerstyle> <listbox.style> <style targettype="listbox"> <setter property="tabnavigation" value="cycle" /> </style> </listbox.style> </listbox>
Comments
Post a Comment