Click here to Skip to main content
11,490,003 members (53,827 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# XAML Silverlight , +
Hi

I have a task in which i have to play different videos on different button clicks.

i have two XAML pages page1 and page2. I have two buttons in page1 and a media element in page2. I have two videos in my local folder. when i click button1 video1 should play and when i click button2 video2 should play.

can anyone suggest me solving this


thanks in advance
Posted 11-Dec-12 23:16pm
Comments
ridoy at 12-Dec-12 4:53am
   
you can use mediaelement on button click event..when it is button 1 play vedio 1 in mediaelement and then repeat it for button 2
thursunamy at 12-Dec-12 5:12am
   
When creating second page instance you can send video full path from the second page constructor as a parameter. And then you can start that video from your media element
Raghavanand at 12-Dec-12 6:15am
   
can you give me a small idea for that !! i am new to wp development
Raghavanand at 12-Dec-12 5:57am
   
Thanks for the answers !! can you give me a small example ridoy

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Get the position of the button by passing values from first page to other using query string on click.

navigationservice.navigate(new Uri("/xyz.xaml?pos="+char,UriKind.Relative));

get the value to other page using onnavigatedto .

char = int.Parse(NavigationContext.QueryString["char"]);

Then place the video in a array and call the media element

string[] videos= new string[]{1.mp4,2.mp4};

then add the source of media element
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 610
1 Andy Lanng 233
2 OriginalGriff 208
3 Maciej Los 160
4 Sascha Lefèvre 160
0 Sergey Alexandrovich Kryukov 9,608
1 OriginalGriff 8,475
2 Sascha Lefèvre 3,419
3 Maciej Los 3,106
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 21 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100