Silverlight XAML Primer 8: Listing 2

Handling Silverlight events using JavaScript.

function ButtonMouseClick(sender, eventArgs)
{
    
    if (sender.Name == "btnPlay")
    {
        ChangeTextOpacity(sender,0);
        sender.FindName("mediaElement").play();
    }
    else if (sender.Name == "btnPause")
    {
        sender.FindName("mediaElement").pause();
    }
    else if(sender.Name == "btnStop")
    {
        ChangeTextOpacity(sender,1);
        sender.FindName("mediaElement").stop();
    }
}

function ChangeTextOpacity(sender,opacity)
{
    sender.FindName("PlayText").Opacity = opacity;
}
comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.