Quantcast
Channel: Jacob Gable's Posterous
Viewing all articles
Browse latest Browse all 17

Clearable TextBox Custom Control

$
0
0

After some comments from Laurent Bugnion, of Galasoft and MVVM Light fame, I decided to try my hand at turning this simple little Clearable TextBox into a custom control for better "Skinability".

Media_http3bpblogspot_yysgl

It looks like I've got most of the functionality replicated, including adding two states to help with animations.  The states are "Normal" and "Cleared".  By default, the Cleared state will cause the clear button text to flash red briefly.  You can also now set the ClearButtonTemplate and the ClearButtonContent if you want.  In the picture you can see I've set the ClearButtonContent to Clear and used the default template.

<clr:ClearableTextBox      Text="{Binding SomeText, Mode=TwoWay}"    ClearButtonContent="Clear"    VerticalAlignment="Top"/>

I haven't tested any custom state animations, only the default ones that are included.  Feel free to let me know if you find any problems. The source and binaries are available below.

Clearable TextBox Custom Control Source

Now Playing: The Roots - Don't Say Nuthin

Permalink | Leave a comment  »


Viewing all articles
Browse latest Browse all 17

Trending Articles