c# - WrapPanel grabs focus from its children -


i have (homemade) controls in wrappanel in scrollviewer , want controls focus when click on them or tab through them. wrappanel grabs focus , hands children[0].

<scrollviewer istabstop="false" >    <toolkit:wrappanel>         <!-- children, filled in code. istabstop="true" -->           </toolkit:wrappanel> </scrollviewer> 

the scrollviewer did same thing istabstop="false" made behave. however, wrappanel not have istabstop property. how can make stop grabbing focus children?

i tried set focus 'manually', using focus(), mouse click eventhandler in controls. control gets focus wrappanel grabs right away , ends @ children[0], though attempt stop mouseclick event bubbling (e.handled = true).

somehow working fine me. sharing code snippet of tried.

<grid x:name="contentpanel" grid.row="1" margin="12,0,12,0">         <image name="img" height="100" width="100"/>         <textbox name="tb3" text="text2" keydown="tb3_keydown"  width="200"/>     </grid>     <scrollviewer grid.row="2">     <toolkit:wrappanel orientation="vertical" name="wp">      </toolkit:wrappanel>     </scrollviewer> 

adding textboxes code behind

textbox tb2 = new textbox();     // constructor     public mainpage()     {         initializecomponent();          textbox tb = new textbox();         tb.text = "some text";         tb.width = 200;           tb2.text = "some text";         tb2.width = 200;          wp.children.add(tb);          wp.children.add(tb2);      } 

changing focus 1 textbox inside grid textbox inside wrappanel

  private void tb3_keydown(object sender, system.windows.input.keyeventargs e)     { if(e.key == system.windows.input.key.enter) { tb2.focus(); } } 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -