IntroductionIn this article we will see how to use Media Element in WPF and we will explore some of the basic functionalities such as Play, Pause, Stop, Back and Forward.Crating WPF Application ProjectFire up Visual Studio 2008 and Create a WPF Application and name the project as MediaSampleWPF.Now we will first design the application so that all the functionalities would be clear to us.Add a Media Element, and several Buttons for the functions to be achieved.The following figure is the simple design of the application.XAML ReferenceNow to start with in the beginning of the application all the Buttons except Open should not be enabled. So lets do that.Now we will achieve the functionalities one by one.Open MediaAdd reference to the System.Windows.Forms DLL to use the OpenFileDialog.Add the below code in the respective Button Click event.Play and Pause FunctionAdd the below code in Play Button Click event to achieve the Play and Pause functions.Stop FunctionAdd the below code in Stop Button Click event.Move Back and Forward FunctionAdd the below code in respective Back and Forward Button Click events to achieve Back and Forward.That's it run the application. As we mentioned in the code for opening only WMV files, you can open only WMV file.You can add other extensions like AVI, MPG and MPEG to the Open function. Hope you guys like this article. It's for the beginner level.
Transparent Brushes in WPF
Edit Row Details in Context Menu in DataGrid in WPF
hi, is this player free? Can i use this player in my project?Would you answer a hurry?
Nice and Simple Example o understand very Well
this my first to attempt to work in WPF application please can i ask you .. what is dialogfiles and Dialog result..........thx.
thnx for the tutorial.. but i am not able to play avi files in the media element .. when i select one it shows nothing.. although all the buttons get enabled.. any suggestions from your side..
so, Develop this in silverlight and use it in your application means in your website