WPF texbox focus when render to offscreen buffer

Posted by dr.mo on Stack Overflow See other posts from Stack Overflow or by dr.mo
Published on 2011-06-27T12:18:39Z Indexed on 2011/06/27 16:23 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

i am rendering a textbox to an offscreen buffer using RenderTargetBitmap and i want to enter text into this textbox, however, i can't set the textbox focus (using Focus() has no effect - presumably because the canvas is not attached to a real window?) this has two consequenes: 1 the keyboard input doesn't get captured 2. even if i set the text manually using TextBox text and CaretIndex = index i dont get a caret because of the lack of focus. is there a way to make this focus somehow? and if not, i'd like to at least have the caret visible even if there is no focus, but can't see a way of doing this.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about textbox