忽然發現label設置content的值爲字符串時,若是字符串中包含_的話,在展現出來時下劃線就不見了,百度了一下,發現了問題根源,說的label的ContentPresenter默認將下劃線處理成快捷鍵了。spa
解決的辦法也很簡單,只須要重寫label的樣式,設置不須要處理成快捷鍵便可(RecognizesAccessKey="False"):code
<Style TargetType="Label"> <Setter Property="Foreground" Value="#999999"></Setter> <Setter Property="Padding" Value="0,0,0,3"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Label"> <Border Padding="{TemplateBinding Padding}"> <ContentPresenter RecognizesAccessKey="False"></ContentPresenter> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style>