• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Media Elements in SilverLight

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

 

Summary
Review Date
Reviewed Item
Media Elements in SilverLight
Author Rating
5

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Media Elements in SilverLight"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.

    Support


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.