locked
Displaying media element across multiple pages RRS feed

  • Question

  • Using VS2013 preview - I am trying to play audio across multiple pages in my xaml/c# app. I have successfully accomplished the audio playback by placing the media element in the standardstyles.xaml page and using the visualtreehelper to get access to my media element on different code behind pages.

    The problem that I am having is that I would like to display the media element, and respective transport controls and have not found a way to add the media element in the code behind page to the display page. Using the code behind page, how can I display the media element on the corresponding xaml page?

    Thursday, September 5, 2013 12:48 AM

Answers

  • I think you should have a single page which brings in different user controls in order to change the page's content.  Leave a single media element in place, just change the surrounding elements.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, September 5, 2013 12:18 PM
    Moderator
  • The way Matt pointed out is a goog approach. The downside is that you also have to implement your custom back navigation logic. If you create a CustomControl based on FrameControl and add the mediaelement to the controltemplate of that CustomControl you still have all the Navigation and only one media element. You only have to mack sure your application is creating a instance of your CustomControl instead of frame at startup.

    In our apps that was the way we tooked to solve a similar problem


    lh

    Thursday, September 5, 2013 12:31 PM

All replies

  • I think you should have a single page which brings in different user controls in order to change the page's content.  Leave a single media element in place, just change the surrounding elements.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, September 5, 2013 12:18 PM
    Moderator
  • The way Matt pointed out is a goog approach. The downside is that you also have to implement your custom back navigation logic. If you create a CustomControl based on FrameControl and add the mediaelement to the controltemplate of that CustomControl you still have all the Navigation and only one media element. You only have to mack sure your application is creating a instance of your CustomControl instead of frame at startup.

    In our apps that was the way we tooked to solve a similar problem


    lh

    Thursday, September 5, 2013 12:31 PM