Issue with Data Binding a media file to MediaElement. RRS feed

  • Question

  • All,

    I am having an issue with Data Binding a WMV file that is stored in the Assets directory.

    Below is my Class:

        public class TrainingVideo


            public string TrainingVideoName { get; set; }



    My C# Source Code:

    var DataBox = new TrainingVideo { TrainingVideoName = "Assets/LifeControl_New.wmv" };

    TrainingMedia.DataContext = DataBox;

    Below XML Code:

    <PlayerFramework:MediaPlayer x:Name="TrainingMedia" DataContext="TrainingVideo" HorizontalAlignment="Left" Height="623" Margin="10,5,0,0" Grid.Row="1" VerticalAlignment="Top" Width="1356" Stereo3DVideoRenderMode="Stereo" Source="{Binding TrainingVideoName}"/></Grid>

    I have check the and the correct values are in the variables.

    Below is the current error message.

    Error: Converter failed to convert value of type 'String' to type 'Uri'; BindingExpression: Path='TrainingVideoName' DataItem='Windows.Foundation.IReference`1<String>'; target element is 'Microsoft.PlayerFramework.MediaPlayer' (Name='TrainingMedia'); target property is 'Source' (type 'Uri').

    When I change it to type Uri a break occurs and get a Can't “identify type or Uri.

    I am lost and could use help pointing me to the right direction. If you can please provide more than a 3 sentence comment.



    Monday, March 3, 2014 10:09 PM

All replies

  • Hi,

    You can use MediaElement instead of PlayerFramework:MediaPlayer.

    And you can refer to see video and audio to know how to play audio and video media using a MediaElement in your Windows Store app using C++, C#, or Visual Basic. Also you can refer to XAML media playback sample

    And if you have any questions about PlayerFramework, you should go to this link to post your thread:


    Best Wishes!

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Edited by Anne Jing Tuesday, March 4, 2014 2:33 AM edit
    • Marked as answer by Anne Jing Monday, March 17, 2014 1:39 AM
    • Unmarked as answer by A.B.P.Lambert Monday, March 17, 2014 4:25 PM
    Tuesday, March 4, 2014 2:32 AM
  • Thanks Anne,

    I will test it out this weekend.


    Saturday, March 8, 2014 12:18 PM