我有一個設計師的樣式指南,看起來像一個超鏈接的按鈕,我試圖儘可能接近WPF樣式。如何更改WPF TextBlock中文本和下劃線之間的距離?
但我一直無法改變文本和下劃線之間的距離。 我想添加圖片進行比較,但不幸的是我迄今尚未獲得足夠的積分。
有沒有辦法改變文字和下劃線之間的距離?
這裏是XAML代碼,我到目前爲止有:
<Style x:Key="LinkButton" TargetType="ButtonBase">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ButtonBase">
<StackPanel Orientation="Horizontal">
<TextBlock Text="> "/>
<TextBlock TextDecorations="Underline">
<ContentPresenter/>
</TextBlock>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="{StaticResource LxGrayBrush}"/>
<Setter Property="FontSize" Value="12"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Foreground" Value="{StaticResource LxGreenBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
在你的第二個TextBlock中添加保證金=「0,5,0,0」 –
@FlorianGl:對不起,我讓你感到困惑與兩個TextBlocks。看到接受的答案。 –