This project is read-only.

Databinding playlist items in playlist plugin not working

Topics: Windows 8 Xaml, Windows Phone 8
Jan 22, 2014 at 12:29 AM
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 22, 2014 at 12:34 AM
Neither does binding in the code-behind work:
        BindingOperations.SetBinding(Player.GetPlaylistPlugin(), PlaylistPlugin.PlaylistProperty,
            new Binding("Playlist"));
Feb 2, 2014 at 7: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 });