问题
I have a WPF TextBlock which is causing the text to be clipped. The resulting text is 2 to 3 lines long. Sometimes the bottom of the first line is clipped.

Following is the XAML. The problem is with the TextBlock:
<Grid x:Name="background">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle Width="24"
Height="24"
Margin="10,5"
Fill="{StaticResource ExclaimationIcon}" />
<TextBlock Grid.Column="1"
Margin="5"
VerticalAlignment="Center"
Text="{Binding Message}"
TextWrapping="Wrap" />
<Button Grid.Column="2"
Margin="5"
VerticalAlignment="Top"
Command="{Binding Clear}"
Padding="3"
Style="{StaticResource HiddenButtonStyle}"
Visibility="{Binding AllowedToClear,
Converter={StaticResource ShowOnTrue}}">
<Image Width="12" Height="12"
Source="/AppliancePluginLibrary;component/AdminComponents/Assets/Delete.png" />
</Button>
</Grid>
回答1:
Setting the TextOption.TextFormattingMode to Display fixed this problem.
来源:https://stackoverflow.com/questions/23500188/wpf-textblock-textwrapping-causes-text-to-be-clipped