Showing blank when added the MediaUriElement in a ListBox

Oct 5, 2012 at 1:23 PM

i tried the MediaUriElement of the wpfmediakit it's really great but when i try to add the player to the listbox as a item it is showing blank.

MediaUriElement playe = new MediaUriElement ();
                    playe.Source = new Uri(PathFile);
                    playe.Height = 18;
                    playe.Width = 320;

                    menu.Items.Add(playe);

i tried to add the Element in xaml it is playing good but i don't know why it is not playing when i tried through the code behind. 

<ListBox x:Name="menu" Height="110" Margin="240,23,71,0" VerticalAlignment="Top">
 <WPFMediaKit_DirectShow_Controls:MediaUriElement Source="somefile.avi"/>
</ListBox>

Oct 18, 2012 at 8:29 PM

I have similar problem. Is MediaUriElement working when you created just in code?

Oct 19, 2012 at 3:06 PM

I found a solution. There must be methods BeginInit and EndInit at the begin and end of setting properties.

Feb 4, 2013 at 6:43 AM
Hi Bibo
Can you post the code i tried with begininit and Endinit but video is not working when
added into a listbox.
Thank you.