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".
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 SourceNow Playing:
The Roots - Don't Say Nuthin
Permalink
| Leave a comment »