0
所以这是我的控制器:Mahapps文本框ClearTextButton丢失时添加样式
<TextBox
Width="398"
Height="25"
Margin="23,0,0,0"
>
<TextBox.Style>
<Style TargetType="{x:Type TextBox}" >
<Setter Property="Foreground" Value="Gainsboro"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Controls:TextBoxHelper.ClearTextButton" Value="True"/>
<Setter Property="Padding" Value="0,1,0,0" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Controls:TextBoxHelper.ClearTextButton" Value="True"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
正如你可以看到我添加Property="Controls:TextBoxHelper.ClearTextButton" Value="True"
但我仍然无法看到此Buttons
unlen我删除了所有Triggers
,并添加该控制器内:
<TextBox
Width="398"
Height="25"
Margin="23,0,0,0"
Controls:TextBoxHelper.ClearTextButton="True">
</TextBox>
这个问题可能是你在找什么: http://stackoverflow.com/questions/32230427/extending-textbox-in-wpf-using-mahapps-保持风格 – petric