I'm trying to get my TextBox to grow up to take the full Vertical space of the cell if necessary.
I tried:
- Setting Vertical Aligment to Stretch.
Everything else requires me to set a fixed Height which is not what I want.
Current config:
TextBoxMarkdown = new TextBox();
TextBoxMarkdown.IsMultiline = true;
TextBoxMarkdown.IsEnabled = false;
TextBoxMarkdown.Width = 600;AddWidget(TextBoxMarkdown, 1, 1, HorizontalAlignment.Center, VerticalAlignment.Stretch);
When text is filled in:
dialog.TextBoxMarkdown.IsEnabled = true;
dialog.TextBoxMarkdown.Text = sb.ToString();
Looking forward to the replies
Hi Rui,
There is a method in the Widget Class that allows resizing the box based on the content: SetHeightAuto(). The only problem, as far as I know, is that the TextBox cannot dynamically detect the size of the text. This means that if you write something and trigger an action using the "Changed" event, it will resize the TextBox even if the text is shorter than the TextBox size.
Method SetHeightAuto | DataMiner Docs
Here is an example of how the TextBox will resize after the text changes. Remember that the TextBox does not take into account the size of the text, so it will resize anyway after an event (e.g., clicking out of the TextBox):
dialog.TextBoxMarkdown.Changed += (sender,args) => dialog.TextBoxMarkdown.SetHeightAuto()
I know this doesn't solve the issue, but it might be something helpful that you can play around with!
Hope it helps!