6 wpf margin textblock alignment
是否可以在TextBlock控件中使用边距文本?
我在textBlock控件上的样式如下:
<Style x:Key="InfosStyle" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Height" Value="35"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Justify"/>
<!--<Setter Property="BorderThickness" Value="1"/>-->
<!--<Setter Property="BorderBrush" Value="#BFE3FE"/>-->
<Setter Property="Background" Value="#BFE3FE"/>
<Setter Property="Margin" Value="2,4,0,1" />
</Style>
Run Code Online (Sandbox Code Playgroud)
结果在这里:

为了考试,我想在textBlock中对齐或设置文本边距.
现在:| Chatuje到| _Chatuje
我想在TextBlock的左侧有一些空闲空间.
可用空间TextOfTextBlock
没有
TextOfTextBlock
alp*_*use 21
你需要在你的风格中设置Padding.像这样的东西
<Setter Property="Padding" Value="10,0,0,0" />
Run Code Online (Sandbox Code Playgroud)