Not sure if this is hard to do in XAML, but I have some TextBlock that I am showing on top of the main window using a fixed font size.
If this is larger than the main window, it resizes the main window. I don't want this. I tried this so far but couldn't prevent the main window from getting resized horizontally.
What I want is to resize the TextBlock if it's not going to fit the main window width. Main window width is dynamic so I can't use a fixed unit value.
Here is the code:
<Viewbox StretchDirection="DownOnly">
<Grid Name="InfoTextOverlay" Visibility="Hidden" HorizontalAlignment="Center">
<TextBlock Text="{Binding InfoText, ElementName=MyMainWindow}" Foreground="White" FontSize="40" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</Viewbox>