Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8118215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:24:42+00:00 2026-06-06T04:24:42+00:00

WP7.5/Silverlight App… On my page load, I play a Sound clip (e.g. Hello! Today

  • 0

WP7.5/Silverlight App…

On my page load, I play a Sound clip (e.g. Hello! Today is a wonderful day.)

private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
    seLoadInstance = seLoad.CreateInstance(); //I initialize this seLoad in Initialize method
    seLoadInstance.Play();
}

Now I have 3-4 other elements on the page. When user click on any of them, a sound clip for that element plays.

private void ElementClick_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    seElementInstance = seElement.CreateInstance();
    seElementInstance .Play();
}

What I want is:
When the page first loads and while the seLoadInstance is being played and user clicks the element, I don’t want the seElementInstance to be played.

I can check the state of seLoadInstance like below to not play seElementInstance

private void ElementClick_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
  if(seLoadTextInstance.State != SoundState.Playing)
  {     
        seElementInstance = seElement.CreateInstance();
        seElementInstance .Play(); 
   }
}

But the problem with above is that I have another element that can play the seLoadInstance on it’s click.

Problem: I don’t know how to differentiate if the seLoadInstance being played is first time or upon element click.

Possible solution: One way I see is using different instances to play the same sound.

I was hoping some better way like I set a flag upon load but I couldn’t find any explicit event for SoundInstance completed or Stopped that I can handle.

Any ideas??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:24:45+00:00Added an answer on June 6, 2026 at 4:24 am

    I was able to find a way using flag. Instead of setting a flag upon the firsttime load complete, I set the flag from one of my element that plays the seLoadTextInstance.

    Something like below:

    private bool isElementLoadSoundPlaying = false; //I set this to true below in another handler
    
    private void ElementClick_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
      //This if means LoadTextInstance is playing and it is the first time play
      if(seLoadTextInstance.State != SoundState.Playing && isElementLoadSoundPlaying == false )
      {     
         return;
      }
      seElementInstance = seElement.CreateInstance();
      seElementInstance .Play(); 
    }
    
    private void ElementLoadTextClick_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
      isElementLoadSoundPlaying = true;
      seLoadInstance = seLoad.CreateInstance();
      seLoadInstance.Play();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WP7 app (Silverlight) that has a page with a textbox that
I've added Silverlight toolkit into my WP7 app. <Button Content=Country> <toolkit:ContextMenuService.ContextMenu> <toolkit:ContextMenu> <toolkit:MenuItem Header=England
In WP7 silverlight app, i wanted to use a storyboard animation on a particular
I'm building a wp7 Silverlight app. I need a list that is able to
I writing wp7 silverlight app. I have a listbox with items. I want each
I've set up my Silverlight WP7 app to use a WebBrowser Control to allow
I have to write a simple Silverlight app for WP7. If the phone is
I want to write unit tests for my private methods in WP7 app code.
I have an Image element in my WP7.5 Silverlight app for which I tried
I've developed a WP7 app that uses the MediaElement to progressively download and play

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.