none
How to Add a System.Windows.Controls.MediaElement in a Resource file

    Question

  • Hi,

     Can you please tell me a method where I can add a MediaElement in a resource file, when I used
     resourceWriter.AddResource("mediaElement", mediaElement); an exception is thrown when I come to
     resourceWriter.Generate();

     The exception is

     So, can you guys let me know how I can either de-serialize or use some other method to add the MediaElement as a resource in the resourcefile.
    Thursday, November 22, 2007 12:48 PM

Answers

  • You can use XamlWriter.Save() to serialize the MediaElement into XAML string, and then feed in the ResourceWriter with the XAML string.

     

    Hope this helps

    Tuesday, November 27, 2007 3:19 AM

All replies

  • To add to the previous post.

     The exception encountered was
    "System.Windows.Controls.MediaElement is nor marked as serializable".

    Thanks,
    Mani
    Thursday, November 22, 2007 12:51 PM
  • You can use XamlWriter.Save() to serialize the MediaElement into XAML string, and then feed in the ResourceWriter with the XAML string.

     

    Hope this helps

    Tuesday, November 27, 2007 3:19 AM