<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
       <StackPanel.Resources>
        <Style TargetType="{x:Type TextBox}">
            <Style.Triggers>
                <DataTrigger
Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text.Length}"
Value="140">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <ColorAnimation Storyboard.TargetProperty="Background.Color"
                  To="Salmon" Duration="0:0:0.5" />
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <ColorAnimation Storyboard.TargetProperty="Background.Color"
                  To="White" Duration="0:0:0.5" />
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.ExitActions>
                </DataTrigger>
            </Style.Triggers>
            <Setter Property="FontSize" Value="11"/>
            <Setter Property="MaxLength" Value="140"/>
            <Setter Property="TextWrapping" Value="Wrap"/>
        </Style>
    </StackPanel.Resources>
    <TextBox/>
</StackPanel>
