Looping a media element in Expression blend

All replies

  • I had this same problem as well.

    Unfortunately there is no MediaTimeline and RepeatBehavior="Forever" in Silverlight (as you would use in WPF.

    However what you can do is hook in the media ended event, and call play on your media element.

    For Example:

    protected void myMediaElement_MediaEnded(object sender, EventArgs args)


    // Replay the video

    MediaElement video = (MediaElement)sender;video.Position = new TimeSpan(0);



    If this has answered your question, please hit the Mark as Answered thingy.

    Saturday, August 11, 2007 1:22 PM
  • hi..

    thanks for the reply.

    was just wondering where do i go about putting the codes?

    is it in the .js file?


    thanks again=)

    Sunday, August 12, 2007 1:17 AM
  • Yes, the code goes in your JS file, but please note that you will need wire the MediaEnded event to the method that will start the next media. You can either do it in your XAML or JS code.
    Sunday, August 12, 2007 4:36 AM
  • Hi basically this was the answer i was looking for, Thanks! :)

    P.S sorry i couldn't fint the plpace where to mark "as answered".

    Friday, September 30, 2011 8:00 AM