Have a UserControl that must never exceed 700px in width. Have set it's MaxWidths to 700px.
Inside is a grid - 3 columns. First and second column will have labels, third column will input fields. Label contents will be dynamic based on language.
What I am trying to do is to let my input fields in column 2 be as wide possible once labels in column 0 and 1 get their contents dynamically when control is loaded.
I've set:
1) minimum width on column 2 to make sure the input fields don't get completely hidden if the labels in column 0 and 1 get too wide.
2) set column 2 to Width="*" to let my input fields use all width available when labels are set.
3) Columns 0 and 1 Width="Auto" to let them grow as needed to accommodate labels.
Now I have this problem - if either column 0 or 1 gets a text that is too long, the entire gird starts expanding beyond the maximum size of it's container, and third column gets cut off. Is there any way to stop that, without setting MaxWidth on columns 0 and 1?
No, not really.
If you don't want the labels to get cut off and you don't want the grid to expand passed its parent, your only two options are to set a max width on columns 0 and 1 or set a max width on the labels in columns 0 and 1 and set the text in the labels to wrap. Otherwise, something is going to get clipped or overlapped.