- DOTNET

How to display text with solid color brush

See Also: 1. Hello World Silverlight Example with <TextBlock> Tag
                   2How to display text with solid color brush
                   3. How to use gradient color brush in Silverlight Download Source Code - How to use solid brush in silverlight
If you don't have silverilght installed in your system first go through these articles otherwise please simply skip bellow articles
Silverlight prerequisites and installation for web application development
Silverlight Development Tools & Software
Silverlight plug-in Inplace and Indirect installation, How to
Hello World Silverlight Example with <TextBlock> Tag
Step 1. Open Visual Studio,
Step 2. Open New Silverlight Project

Now By Default you will get Page.xaml with the following code
<Canvas x:Name="parentCanvas"
        xmlns="http://schemas.microsoft.com/client/2007" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Loaded="Page_Loaded" 
        x:Class="SilverlightProject1.Page;assembly=
                    ClientBin/SilverlightProject1.dll"
        Width="640"
        Height="480"
        Background="White"        >

</Canvas>

Step 3. To display a text message in silveright canvas we have tag called <TextBlock>

Find the following modified code after adding <TextBlock> tag with Foreground attribute (Solid Brush)
<Canvas        xmlns="http://schemas.microsoft.com/client/2007" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        x:Name="parentCanvas" 
        Loaded="Page_Loaded" 
        x:Class="SilverlightProject1.Page;assembly=ClientBin/SilverlightProject1.dll"
        Width="885"
        Height="500"
        Background="White"        >
  <TextBlock Text="Hello World with Solid brush" FontSize="50" Foreground="#FF0D2764"/>

</Canvas>
 

Step 4. Now Run the Application By Pressing F5 with debugging or Ctrl+F5 without debugging.

Download Source Code - How to use solid brush in silverlight
See Also: 1. Hello World Silverlight Example with <TextBlock> Tag
                   2How to display text with solid color brush
                   3. How to use gradient color brush in Silverlight
Copyright © 2015 DOTNET All Right Reserved