2012-10-04 61 views
0

我創建了以下樣式:創建鏈接拉布勒風格WPF

<Style x:Key="LinkText" TargetType="{x:Type Label}"> 
    <Setter Property="Label.FontFamily" Value="Verdana"/> 
    <Setter Property="Label.FontSize" Value="13"/> 
    <Setter Property="Label.Foreground" Value="Blue"/> 
    <Setter Property="TextBlock.TextDecorations" Value="Underline"/> 
</Style> 

但是,當我嘗試使用它的一些標籤上的下劃線丟失。

我在我的用戶寫道:下一個標籤:

<Label Grid.Column="1" HorizontalAlignment="Right" Style="{StaticResource LinkText}"> 
<TextBlock>some text</TextBlock></Label> 

我看到,除了強調屬性格式 所有樣式屬性如何創建標籤樣式與底線?

回答

0

嘗試使用TextBlock控件而不是Label控件。它的行爲或多或少完全相同,並且應該允許您在文本中加下劃線。

TextBlock.TextDecorations依賴項屬性屬於TextBlock控件,因此您必須使用它來強調文本。