Click here to Skip to main content
15,885,216 members
Articles / Desktop Programming / WPF
Tip/Trick

Custom WPF TextBox Style

Rate me:
Please Sign up or sign in to vote.
1.80/5 (4 votes)
28 Dec 2010CPOL 45.4K   1   8
TextBox Style which resembles the Twitter's text field.
Download TwitterTextBox for WPF Demo and Source Code



View Image



Introduction



This tip was written to demonstrate how to customize the rendering of the standard TextBox control provided by Microsoft. You can use this custom style to achieve the Twitter's TextBox look and feel.

Using the Style



To make use of the custom Style you need to set the Style property of your TextBox controls.

The example code below demonstrates how to apply the style:

<TextBox Style="{StaticResource TwitterTextBoxStyle}" Height="25" Name="textBox1" Width="300" />


Points of Interest



I have made this TextBox Style as part of my university project. I wanted to add to my application some cool glow effects and animations.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralFYI - Textbox.Tag is bound to the watermark Pin
Bogatitus17-Jun-19 10:34
Bogatitus17-Jun-19 10:34 
GeneralReason for my vote of 1 not helpful Pin
st0rmrd17-Aug-11 1:36
st0rmrd17-Aug-11 1:36 
GeneralThanks for the code sample, just what I needed! Pin
Riaan77721-Jul-11 0:56
Riaan77721-Jul-11 0:56 
GeneralThis is just a short article(tip), it should not be too long... Pin
John_Smith784-Jan-11 23:52
John_Smith784-Jan-11 23:52 
GeneralJohn i am well versed with WPF! but what about others? you s... Pin
Tarun.K.S30-Dec-10 7:38
Tarun.K.S30-Dec-10 7:38 
GeneralThe provided Style definition extends the standard TextBox's... Pin
John_Smith7829-Dec-10 2:19
John_Smith7829-Dec-10 2:19 
GeneralReason for my vote of 2 No explanation at all! Pin
Tarun.K.S29-Dec-10 1:17
Tarun.K.S29-Dec-10 1:17 
GeneralStill no explanation of what this is all about. Pin
Richard MacCutchan24-Dec-10 6:27
mveRichard MacCutchan24-Dec-10 6:27 
Still no explanation of what this is all about.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.