Here is my very simple xaml:
<Window x:Class="Test.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" Background="Black" Padding="0" Margin="0" >
<Viewbox Margin="0">
<TextBlock Text="Test" Background="AliceBlue" Foreground="Red"
Padding="0" Margin="0" />
</Viewbox>
</Window>
This is supposed to scale the Label/Textblock (I've tried both) to fill as much of the window as possible while maintaining aspect ratio of the text. The issue is, if you drag the size of the window around you can see that there seems to be some sort of invisible, un-changeable padding on the top and bottom of the text.
The left and right don't seem to have it (left image), but the top and bottom do (right image):
Here I pointed out the extra padding I was talking about:
I would expect it to render more like this (I did this manually, so the aspect ratio is not perfect):
Has anyone ever overcome this? Maybe I need to be drawing this text directly with GDI+ or something, but I'm not even sure where to start with that, so any keywords I should hit Google with would also be appreciated!
It's part of the font as far as i can tell, try setting FontFamily
to Webdings
.