I would like a nice little orange border around my Textbox
whilst the user is typing in it (Has Focus).
I defined styles for the tiggers I think I need, but there is a strange behavior.
When the cursor is in the TextBox
and the WPF app has focus, it has a blue border.
But while the cursor is focused and I click outside of the app (like in visual studio) it becomes orange.
I've tried overriding many triggers but to no avail.
This is what happens when I focus on the textbox but am focused on another app:
This is the textbox w/focus in the app:
And here is the code:
CTRL Xaml:
<TextBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
Style="{StaticResource RegistrationTextbox}"
IsReadOnly="{Binding Path=IsFirstNameReadOnly}" Text="{Binding FirstName}" BorderThickness="0.99">
<b:Interaction.Triggers>
<b:EventTrigger EventName="GotFocus">
<b:InvokeCommandAction Command="{Binding GotFocusFirstNameCommand}" />
</b:EventTrigger>
</b:Interaction.Triggers>
</TextBox>
Styles:
<Style x:Key="RegistrationTextbox" TargetType="{x:Type TextBox}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Style.Triggers>
<Trigger Property="IsReadOnly" Value="true">
<Setter Property="Background" Value="#f2f2f2"/>
<Setter Property="BorderBrush" Value="#f2f2f2"/>
<Setter Property="BorderThickness" Value="2"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="BorderBrush" Value="Red"/>
<Setter Property="BorderThickness" Value="2"/>
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" Value="#FAA634"/>
<Setter Property="BorderThickness" Value="2"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#F8B963"/>
<Setter Property="BorderThickness" Value="2"/>
</Trigger>
</Style.Triggers>
</Style>