Gradient Origin in WPF

Gradient Origin

To Fill the colors in elliptically we use following properties with Radial Gradient Brush

 

Eg to fill the colors elliptically in a rectangle

 

Create a new window

      ↓

Go to xaml source

      ↓

write the following code within grid

      ↓

<Grid>

<Rectangle height =”1—“ width=”200”>

<Rectangle.fill>

<Radial Gradient Bruch Gradient origin = “0.5, 0.5”

center = “0.5, 0.5” Radius X = “0.5” Radius Y = “0.5”>

<Gradient stop color=”yellow” offset = “0”/>

<Gradientstop color = “Red” offset = “0.23”/>

<Gradientstop color = “blue” offset =”0.75/>

<Gradientstop color+ “lineGreen” offset+”1”/>

</Radial Gradient Brush>

</Rectangle.fill>

</Rectangle>

 

Image brush:-

This is used to display the required image within the 2D graphic object like rectangle or ellipse etc.

 

Properties:-

Image Source  is the property which is used to display required image within the object

 

Eg With Image Brush:-

Create a new window

      ↓

Go To Xaml-1 Source

      ↓

Write the code in <Grid>

<Grid>

<Rectangle height =”100”, width = “100”>

<Rectangle.fill>

<ImageBrush>

<Image brush Imagesource = “Fl.Jpg”/>

</Image Brush>

</Rectangle-fill>

</Rectangle>