mobileNavlogo
headerlogo

SilverLight Brushes

20 September, 2018

Ratings

Related Blogs

SilverLight Brushes are used to fill colors, images and videos in silver light objects.

The silver light supports five types of brushes

  1. Solid color brush
  2. Linear gradient brush
  3. Image brush
  4. Radial Gradient Brush
  5. Video Brush

Solid Color Brush

This brush is used to fill single color in the silver light controls, while working with brushes we have to work with color related properties.

Example:- Open we silver light application

Go to XAML Mode In the grid tag

<grid X:Name = “layout Root” Background = “white”> <Rectangle X:Name= “r1” height = “100” width = “300” Stroke = “blue” stroke thickness = “10” stroke dash array = “2” stroke dash offset = “5”>

<Rectangle. fill>

</solid color brush color = “Red”>

</solid color brush>

</Rectangle. fill>

</rectangle>

</grid>

Stroke dash array property gives border styles

Stroke dash offset property rotates the border

Rectangle. Fill tag gives special features to the fill property

Linear Gradient Brush

This brush is used to fill multiple colors in the silver light controls in the linear order, while working with this brush we can work with any color related property

Example:- open new silver light application

Go to XAML mode

In the grid tag

<grid X:Name = “layout Root” Background= “white”>

<Rectangle X: Name= “r1” Height = “150” width = “250” Stroke = “Blue” stroke thickness = “10”>

<rectangle .fill>

<linear Gradient brush start point = “0,0” end point = “1,1”>

<Gradient stop offset = “.2” color = “Red” > < /Gradient stop>

<Gradient stop offset = “.4” color = “blue”> </gradient stop>

<gradient stop offset = “.6” color = ‘Green”> </gradient stop>

<gradient stop offset = ”.8” color = “black”> </gradient stop>

</linear Gradient brush>

</Rectangle .fill>

</rectangle>

</Grid>

àThe linear gradient brush gives multiple liners based on start point and end point properties, two properties takes x, y locations, by default two properties default parameter  values are (0,0) and (1,1)

àThe start point property takes the value from upper left comes,

àEnd point property takes the value from bottom right corner using gradient stop tag we can fill  one color in the silver light control, using this tag we can set color location and filling color.

Image Brush

This brush is used to fill one image in the silver light controls, while working with this brush we can work with any color related property           

  Example:- open new silver light application

Go to XAML mode

In the canvas tag

<canvas>

<text block x: name = “t1” Text = “welcome”  Font size = “100”>

<Text Block . Foreground>

<Image Brush Image source = “d:lone. Jpg” > </Image brush>

</Text block. Foreground>

</text block>

<ellipse X:name = “el” Height = “150” width = “200” stroke = “blue” stroke thickness = “10” canvas. Top = “120”>

<ellipse .fill>

<Image brush Image source = “d./one.jpg”> </Image brush>

</ellipse .fill>

</ellipse>

</canvas>

Radial Gradient Brush

This brush is used to fill multiple colors in the silverlight controls in the circular order, while working with this brush we can work with all color related properties.

Example:- Open new silver light Application

Go to XAML Mode

In the grid tab

(0,0)        Control

Screenshot_5

<Grid X:Name=”Layout Root” Background = “white”>

<Ellipe X:Name = “el” Height = “200” width = “300” stroke = “blue” stroke thickness = “10”>

<Ellipse.fill>

<Radial gradient brush gradient origin = “.0,.5” radius = “.4” radius Y= “.5”>

<Gradient Stop Offset = “.2” color = “Red”> </Gradient stop>

<Gradient stop offset = “.4” color = “Green”> </gradient stop>

<Gradient stop offset = “.6” color = “yellow”> </gradient stop>

<Gradient stop offset =”.8” color = “black”> </Gradient stop>

</Radial gradient Brush>

</ellipse. Fill>

</Ellipse>

</Grid>

Using Gradient Origin property we can set gradient local point, this property takes two arguments X location and Y location using Radius X, Radius Y properties we can set the X gradient size and Y Gradient size

Video Brush

This Brush is used to fill video in the silver light control, the video Brush is depending on the media element control

About Author
Authorlogo
Name

TekSlate

Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .