Home > Blockchain >  Can I append a TextBlock immediately following the text of a TextBox
Can I append a TextBlock immediately following the text of a TextBox

Time:01-17

I have a two-way databound TextBox that I need to remain editable, but conditionally also append an additional non-editable string to. Is there any way of achieving this?

I'm not talking about defining a string mask, I'm talking about appending "Ghost text" to the end of a user-provided string.

Something along the lines of this:

Ghost Text in textbox

(I want the user to edit the bit in black, and the grey bit to be appended at the end after they finish their edits, but to not be editable in and of itself)

For additional clarity, this is the closest example that I could think of that is similar. I don't want to explain my exact problem domain, but it does map quite nicely to the concept of providing a new directory on an existing provided user directory.

As per the question title, I was considering adjusting the position of a TextBlock to the end of the TextBox text, and doing something like enter image description here

Using the background brush sort of saves complexity of stacking controls and you could encapsulate some behaviour just in a style.

Extending using an attached property to compose functionality if you wanted say a watermarktextbox.

  • Related