.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Articles >> Silverlight >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Customize TextBox Control in Silverlight Application

Posted By:Diptimaya Patra       Posted Date: March 25, 2010    Points: 25    Category: Silverlight    URL: http://www.dotnetspark.com  

Customize TextBox Control in Silverlight Application. In this sample I will show you how you can change the Text ForeGround and the CaretBrush.


In my previous article "Customizing Slider Control In Silverlight 3" we saw some customization of Slider control. In this article we will see how can we customize our common TextBox Control. In this sample I will show you how you can change the Text ForeGround and the CaretBrush.

Creating Silverlight 3 Application

Open up Blend 3 and create a Silverlight 3 Application.


  1. Go ahead and draw a TextBox into your Grid and make it larger so that you can see the changes clearly.


    I have changed the Back ground color as black and the Foreground as Linear Gradient Brush. Here is the Xaml code for your reference.



    Now we will change the CaretBrush, Caret is nothing but a vertical line. When you type something in the TextBox one thin line used to blink. The default color for it is Black. Now we will modify to match to our Foreground Text.
  2. Select the CaretBrush and change the Brush to LinearGradient Brush.


    Of course you can't see the Caret while you design. So run your application and now try to type something in the TextBox. You will be able to see the Caret changed to its Linear Gradient Color that we have provided.


    Here is the XAML code for your reference.

That's it you have successfully customized your TextBox control.

You can also download the sample code used in the above example.

Enjoy Coding!
 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend