Databinding playlist items in playlist plugin not working

Topics: Windows 8 Xaml, Windows Phone 8
Jan 21, 2014 at 11:29 PM
Databinding a collection of playlist items does not seem to work. I am using MVVM and my bound property is updating properly, however calling GetPlaylistPlugin on the player and inspecting the playlist shows that it has not updated.

Here is the player in xaml:

<Grid x:Name="LayoutRoot" Background="Transparent">
                CurrentPlaylistItem="{Binding CurrentPlaylistItem, Mode=TwoWay}"
                Playlist="{Binding Playlist}"
Jan 21, 2014 at 11:34 PM
Neither does binding in the code-behind work:
        BindingOperations.SetBinding(Player.GetPlaylistPlugin(), PlaylistPlugin.PlaylistProperty,
            new Binding("Playlist"));
Feb 2, 2014 at 6:16 PM
Xaml does not provide the DataContext to perform the binding against so you need to set the binding Source explicitly. For example, this will work:
BindingOperations.SetBinding(playlistPlugin, PlaylistPlugin.PlaylistProperty, new Binding() { Path = new PropertyPath("Playlist"), Source = player.DataContext });