When I include an underscore in a label text, to get access key functionality, the label suddenly jumped right by a certain amount of pixels.
When I tried this out in Kaxaml, I realized it was a Style
with TargetType="TextBlock"
that applied margin, only to the label with the underscore in it.
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Margin" Value="5,2,0,1" />
</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0">Avfallets _Id:</Label>
<Label Grid.Column="0" Grid.Row="1">Avfallets Id:</Label>
</Grid>
What is the logic here? Is somehow a label not a TextBlock until you add an underscore to it?