wpf controls - How do I select all the text in a WPF textbox on click -


i have several textboxes within uniformgrid.

i want select within textbox when clicked i'd rather event came uniformgrid. able implement selecting text gotkeyboardfocus when use keyboard code below in handler. when merely click on box highlights while mouse down , on mouse cursor appears rather text remaining selected.

    foreach(textbox box in grid.children)     {         if (box.iskeyboardfocuswithin)         {             box.selectall();             e.handled = true;             break;         }     } 

i have previewkeyup handler watches max number of letters moves next box. each box initialized max number of letters when screen loads. why want select on text in textbox can typed on easily.

i able use gotmousecapture except doesn't work if click near text near edge of textbox.

try hooking previewmouseup routed event. worked me.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -