Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF TextBox Overwrite

Tags:

c#

wpf

In WPF, is there an easy to allow overwriting of text in an textbox?

Thanks
Tony

EDIT: I guess i wasn't to clear. Sorry.

I have a TextBox that the user is allowed to type 6 characters. If the user types 6 characters and then for whatever reason put the cursor at the start or somewhere in the middle of the 6 characters and starts to type, I want what they are typing to overwrite characters. Basically act like overwrite mode in Word.

Thanks again.

like image 550
Tony Avatar asked Jul 13 '26 16:07

Tony


1 Answers

I would avoid reflection. The cleanest solution is the following:

EditingCommands.ToggleInsert.Execute(null, myTextBox);

like image 160
raf Avatar answered Jul 16 '26 06:07

raf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!