I have a very simple and basic question, yet were unable to find it being discussed anywere. With the standard WPF Textbox control, when you don't set it's Witdth property, the text will autosize. That's ok, but the text will also grow when you type in a text longer that the view area.
This behaviour is however annoying. I want the textbox to use the width it is given by the parent panel (grid, stackpanel), but not to dictate the width back. The only way one can stop the growth seems to be setting the Width or MaxWidth property, but that is pretty poor windows.forms solution. When I have a window containing a grid and there a couple of textboxes, then I want to resize the textboxes to resize when user resizes the window. But withouth the textboxes growing wild when user types.
I tried binding MaxWidth to ActualWidth, which was not a good idea (the textbox remained at zero width), I tried playing with MeasureOverride and ArrangeOverride, none of them turned to work as expected. At best I was able to make the textbox stop growing, but still the caret was diappearing beyond the right edge like the textbox still continued there.
So, is there any standard way to stop the textbox growing as the user types?
View Complete Post