Configure InteractiveViewModel in XAML

Topics: Windows 8 Xaml
Mar 28, 2013 at 8:54 PM
Given the following MediaPlayer configuration:
                InteractiveViewModel="{Binding PlayerViewModel}"
How do I, in the XAML code, assign the Player to the InteractiveViewModel's MediaPlayer property (which it requires in order for it not to throw null reference exception)?
Apr 5, 2013 at 4:39 PM
Christian, you can supply a custom InteractiveViewModel if you need it (note: this is not necessary and only needed for advanced control over the behavior of the UI).

To create your own viewmodel you can either:
1) Create a custom implementation of IInteractiveViewModel
2) Create a custom class that inherits from InteractiveViewModelBase
3) Create a custom class that inherits from InteractiveViewModel
Note: for #3, you need to make sure you set to set the MediaPlayer property on it to the player or it will throw a null ref exception. I suspect this is what is happening to you.

Hopefully this helps answer your question, let me know if I misunderstood,

Nov 27, 2013 at 1:49 PM
I believe that the OP knows how to create the view model class to use as interactive view model.
The problem is how to supply the Media Player instance to the view model when the interactive view model
is bound in XAML, i.e. avoiding the problem described in your note above.