I need a panel with 3 items arranged horizontally, one aligned left, one right and the last centered in the remaining space. I can get this with:
<DockPanel LastChildFill="True">
<TextBlock DockPanel.Dock="Left" Text="TextLeft" FontSize="40" Foreground="DarkOrange"/>
<TextBlock DockPanel.Dock="Right" Text="TextRight" FontSize="40" Foreground="DarkOrange"/>
<TextBlock Text="TextMiddle" FontSize="40" HorizontalAlignment="Center"/>
</DockPanel>

But I’d like that when the width is smaller than the sum of item widths that it is “TextRight” that gets eaten into NOT “TextMiddle” as is shown below:

Note Ive tried adding MinWidth on TextMiddle – but this doesn’t change the behavior – because TextMiddle is last child of a LastChildFill=”True” DockPanel.
The XAML below gets me the correct behavor on resize (TextRight gets eaten into when space in limited) but “TextMiddle” is not centered in the available space when there is enough width:
<DockPanel LastChildFill="False" >
<TextBlock DockPanel.Dock="Left" Text="TextLeft" FontSize="40" Foreground="DarkOrange"/>
<TextBlock DockPanel.Dock="Left" Text="TextMiddle" FontSize="40" HorizontalAlignment="Center" />
<TextBlock DockPanel.Dock="Right" Text="TextRight" FontSize="40" Foreground="DarkOrange"/>
</DockPanel>


I’m sure there is an easy solution to this – maybe by using a subpannel in one of the items – but I just cant get my head around exactly how. Any help much appreciated.
Maybe this is it?