I have the following Xaml (simplified for brevity, but will repro the problem in Xamlpad or Kaxaml):
<DockPanel Width="400">
<TextBlock DockPanel.Dock="Left" TextWrapping="Wrap">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vestibulum massa metus, ornare in fringilla nec, fringilla at orci.
Nunc pharetra enim sit amet sapien aliquet eu euismod turpis vehicula.
Aenean gravida tempus lectus ut ornare.
Nullam massa augue, suscipit vel consectetur fringilla, pretium vitae neque.
</TextBlock>
<Button MinWidth="100" VerticalAlignment="Center" HorizontalAlignment="Left">Hello world</Button>
</DockPanel>
My problem is that I want the Button to take its minimum 100px of space, and for the text to wrap suitably to leave that space. However, what happens is that the text wraps as close to 400px as possible, and then the Button is clipped.
If I Snoop the output I can see that the button is rendering at the desired 100px, but it's being clipped off the side of the DockPanel.
If I reverse the Dock (so the button is docked "Right" and the TextBlock fills) then I get the layout I want, but unfortunately that's not an option due to the surrounding layout.
Is there something I can do that will make the DockPanel a) not clip and b) layout in a way that respects the MinWidth? Or am I stuck finding an alternative layout mechanism?
Thanks in advance!