I am making a WPF
application and I have a button
that contains "X"
. By default the font size is 12 and the text is center, but as soon as I increase the font size, the alignment drops. I am unable to understand.
Center text at Font size 12:
Off-center text at Font size 24
My code:
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button Content="-" Foreground="White" Margin="756,8,8,0" Height="30" VerticalAlignment="Top" VerticalContentAlignment="Center" BorderThickness="0" Background="{x:Null}" FontWeight="Bold"/>
<Button Content="X" Foreground="White" Margin="6,8,8,0" Height="30" VerticalAlignment="Top" VerticalContentAlignment="Center" BorderThickness="0" Background="{x:Null}" FontWeight="Bold"/>
</StackPanel>