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:
(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 this answer proposes, but that means that I'll have to both figure out where the textbox text ends, and crop the TextBlock
so it doesn't overflow the TextBox
.
I tried this with a RichTextBox
, but that has its own problems to solve. <Run IsEnabled="True"/>
doesn't appear to work how I want, and if the editable and non-editable portion are different colours, they can end up merging and its easy to accidentally remove the user entered portion.
These are just things I have tried, I've googled around and found no promising alternatives, can anyone here suggest anything?