Media Elements in SilverLight

Ratings:
(4)
Views:378
Banner-Img
  • Share this blog:

Media element

This control is used to access default video player from the operating system, using this control we can play different type of video formats and audio formats, while working with video brush we have to decide playing source in the media element control, we have to refer media element control reference in the video brush. Example:- open new silver light Application Go to XAML code In the grid tag <grid X:name = “Layout Root” Background = “white”> <Media element X: Name = “M1” source = “d:/advit.wmv” opacity = “0”> </Media Element> <path X:name = “p1” Height = “300” width = “300” stroke = “Red” stroke thickness = “10”> <path.data> <Rectangle Geometry Rect = “10, 10, 200, 200”> <I rectangle Geometry> </path. Data> <path.Fill> <video brush source name = “m1”> </video brush> </path. Fill> </path> </grid>  

Path

The path control is used to create work space for defining collection of geometries, path.Data tag using for defining one geometry. Rectangle geometry tag used to define rectangle geometry. Rect property used to decide rectangle geometry size, this property takes four parameters

  1. Starting x location
  2. Starting Y location
  3. Ending X location
  4. Ending Y location

 

Implementing dynamic control with radial gradient brush

Open new silverlight  application Add button control on the grid layout Go to button click event Private void button  click (object sender, routed E.Vent Args e) { Rectangle r = new rectangle (); r.Hieght = 200; r.width = 200; Radial gradient brush b = new radial gradient brush (); Gradient stop  g1 = new gradient stop(); G1. Offset = .2; G1.color = cdors. Red;

  1. gradient stops. Add(g1);

gradient stop g2 = new gradient stop(); g2. Offset = .4; g2. Color = colors. Green;

  1. gradient stops . add (g2);

gradient stop g3 = new gradient stop(); g3. Color = colors. Blue; b.gradient stops . add (g3); r.fill = b; Layout Root. Children. Add (r);

  • Layout root is default name to the grid container
  • Layout root. Children statement refers all controls from the grid container
  • ‘add’ method adding new control on the container

 

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

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


Stay Updated


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