Page 1 of 1

LibVLCSharp.WPF VideoView data binding property MediaPlayer to viewmodel

Posted: 29 Aug 2019 10:59
by leonY
Hi there

I have a LibVLCSharp.WPF.VideoView control on my WPF view page like

Code: Select all

<UserControl> <Grid> <LibVLCSharp.WPF.VideoView /> </Grid> </UserControl>
Is there a way to data bind the MediaPlayer property of the VideoView control to my page's ViewModel?

In fact, I only want to access the MediaPlayer.Hwnd property and would like to explore a way of getting it done in page's ViewModel, instead of in page's code-behind file.

Re: LibVLCSharp.WPF VideoView data binding property MediaPlayer to viewmodel

Posted: 29 Aug 2019 15:47
by mfkl
Is there a way to data bind the MediaPlayer property of the VideoView control to my page's ViewModel?
Using regular WPF databinding. I encourage you to read about it.

Code: Select all

<vlc:VideoView MediaPlayer="{Binding MediaPlayer}"/>
I only want to access the MediaPlayer.Hwnd property
When you set the mediaplayer on the videoview, the mediaplayer gets its hwnd set to that view's handle. You already have that information as far as I understand, and don't need to access the mediaplayer for this.