Silverlight Paint TextBox in VB.NET

In this article you will learn how to paint an TextBox in Silverlight.
  • 1850

As I mention early in my article about the silverlight that one of the main capabilities of Silverlight is to make user interfaces for web sites. Silverlight's scope is not to replace HTML-based web sites, but instead to augment HTML. You should think of Silverlight as something that enables you to create content inside a web page, not something you would use to create replacement content for your existing web pages.

Silverlight provides a number of ready-to-use Shape objects. All shape objects inherit from the Shape class. Available shape objects include Ellipse, Line, Path, Polygon, Polyline, and Rectangle.

Here I will give an interesting example in which you will see how to paint an TextBox in Silverlight.

Example to paint an TextBox:

<UserControl x:Class="SilverlightApplication15.MainPage"
    xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
    xmlns:d='http://schemas.microsoft.com/expression/blend/2008' 
    xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006' 
    mc:Ignorable='d' 
    d:DesignWidth='640' 
    d:DesignHeight='480'>
    <Canvas>
        <TextBlock Margin="5"  FontWeight="Bold" FontSize="40" TextWrapping="Wrap"TextAlignment="Center">
        <TextBlock.Text>Welcome to the c# Corner.</TextBlock.Text>
        <TextBlock.Foreground>
          <LinearGradientBrush StartPoint="1,0" EndPoint="1,1">
            <GradientStop Color="Yellow" Offset="0.0" />
            <GradientStop Color="Red" Offset="0.45" />
            <GradientStop Color="Blue" Offset="0.55" />
            <GradientStop Color="LimeGreen" Offset="1.1" />
          </LinearGradientBrush>
        </TextBlock.Foreground>
        </TextBlock>
    </Canvas>
</
UserControl>

Output Window

paint.gif

Conclusion

Hope this article helps you to understand how to paint the TextBox in Silverlight.

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.