开发者

margin text in TextBlock

开发者 https://www.devze.com 2023-02-05 17:46 出处:网络
Is it possible margin Text in TextBlock control ? My style on textBlock control is here : <Style x:Key=\"InfosStyle\" TargetType=\"{x:Type TextBlock}\">

Is it possible margin Text in TextBlock control ?

My style on textBlock control is here :

<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>
开发者_开发知识库

Result is here:

margin text in TextBlock

For examole I would like align or set margin on text in textBlock.

Now: |Chatuje to |_Chatuje

I would like have some free space on left side in TextBlock.

Free space TextOfTextBlock

No

TextOfTextBlock


You need to set Padding in your style. Something like this

<Setter Property="Padding" Value="10,0,0,0" />


Looks like you need to set Padding instead of Margin.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号