How can I constrain a vertical WPF StackPanel‘s width to the most narrow item it contains. The StackPanel‘s width must not be greater than the width of any other child element.
How can I constrain a vertical WPF StackPanel ‘s width to the most narrow
Share
Unfortunately the IValueConverter approach will not always work; if the children are added to StackPanel statically, for example, the child collection will be empty at the time of binding (so I discovered). The simplest solution is to create a custom panel:
You can use the panel as illustrated by the following XAML:
Which will render something like the following:
I hope this helps.