Gradient Origin in WPF
  • Share this blog:

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.  


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>  

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses


About Author
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 in the market.

Stay Updated

Get stories of change makers and innovators from the startup ecosystem in your inbox