vb.net wpf popup no focus -
i have several popups in wpf application, work fine.
however, last 1 not accepting focus or input in textboxes. , don't see why.
<label x:name="lblsearch" grid.row="0" grid.column="0" grid.columnspan="1" horizontalalignment="center" verticalalignment="top" margin="0,5" height="30" width="auto">search</label> <textbox name="txtsearch" grid.row="0" grid.column="1" grid.columnspan="1" horizontalalignment="center" verticalalignment="top" margin="0,5" height="30" width="200" isreadonly="false" isenabled="true"></textbox> <button name="btnsearch" grid.row="0" grid.column="2" style="{staticresource buttonsmall}" template="{dynamicresource blackbutton}" margin="5">search</button> <label x:name="lblreplace" grid.row="1" grid.column="0" grid.columnspan="1" horizontalalignment="center" verticalalignment="top" margin="0,5" height="30" width="auto">replace</label> <textbox name="txtreplace" grid.row="1" grid.column="1" grid.columnspan="1" horizontalalignment="center" verticalalignment="top" margin="0,5" height="30" width="200" isreadonly="false" isenabled="true"></textbox> <button name="btnreplace" grid.row="1" grid.column="2" style="{staticresource buttonsmall}" template="{dynamicresource blackbutton}" margin="5">replace</button> <button name="btnstopsearch" grid.row="2" grid.column="3" style="{staticresource buttonsmall}" template="{dynamicresource blackbutton}" margin="5">done</button> <dockpanel grid.row="2" grid.column="0" grid.columnspan="2"> </dockpanel> </local:gridex> </dockpanel> </border> </border> </popup>
i tried code force focus on no avail:
private searchwhere string = nothing private sub txttypeeditor_keydown(sender object, e forms.keyeventargs) handles txttypeeditor.keydown if e.keycode = forms.keys.f andalso e.control andalso not e.alt andalso not e.shift popupsearch.isopen = true txtsearch.focus() keyboard.focus(txtsearch) searchwhere = "typeeditor" e.handled = true end if end sub private sub popup1_opened(sender object, e eventargs) handles popupsearch.opened txtsearch.focus() keyboard.focus(txtsearch) end sub
it appears txttypeeditor holds onto focus. idea how blur it?
i have workaround: if blur textbox focusing textbox popup accepts focus.
however if user clicks txttypeeditor textbox , clicks inputfield in popup, mouse focus switches popup, keyboard focus stays textbox.
this guess: maybe related txttypeeditor_keydown
event stays somehow in txttypeeditor? give try keypress
instead (if not affecting other part of code)
Comments
Post a Comment