i have this style of textboxes. when i use it and try to cycle through my content using Tab button textboxes using this style gains focus after hitting the Tab button two times. In the first Tab hit though, the "Focused" state animation works but the caret is not there. I hit tab again and the caret appears.
<Style x:Key="MPTextBox" TargetType="{x:Type TextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border x:Name="border" BorderBrush="#FFEF7B54" BorderThickness="2" Background="White" CornerRadius="5">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="Disabled"/>
<VisualState x:Name="ReadOnly"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="border">
<EasingColorKeyFrame KeyTime="0:0:0.5" Value="#FF57C0AF"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Unfocused"/>
<VisualState x:Name="Focused">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="border">
<EasingColorKeyFrame KeyTime="0" Value="#FFED4B15"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TextBox Background="{x:Null}" BorderBrush="{x:Null}" CaretBrush="#FFF05A29" BorderThickness="0" Margin="5,5,5,0" FontFamily="Public Enemy NF" FontSize="16" Foreground="#FFF05A29" HorizontalAlignment="Stretch" d:LayoutOverrides="Width, Height" VerticalAlignment="Stretch" Text="{Binding Text, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I want to have it all happening on only one Tab hit.
Another thing with this textbox is that if i am trying to access the Text property in an event handler for example KeyDown event it shows null and the text within the control is never set until the textbox loses focus.