Reputation: 6460
So this is my controller:
<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>
As you can see i added Property="Controls:TextBoxHelper.ClearTextButton" Value="True"
but still i cannot see this Buttons
unlen i removed all Triggers
and add this inside the controller:
<TextBox
Width="398"
Height="25"
Margin="23,0,0,0"
Controls:TextBoxHelper.ClearTextButton="True">
</TextBox>
Upvotes: 1
Views: 822
Reputation: 169240
You should base your Style
on the "MetroTextBox" Style
:
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MetroTextBox}" >
<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>
Or the implicit one:
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}" >
...
Upvotes: 4