[]
You can add media content by creating a C1MediaItem object and then setting its C1MediaItem.MediaSource property to the location of your media file. In this topic, you will add a video file to the media player in the Properties window, in XAML, and in code.
At Design Time (Visual Studio)
To add video content, complete the following steps:
At Design Time (Blend)
To add video content using Blend, complete the following steps:
In XAML
To add video content using XAML, complete the following:
Place the following markup between the _<c1mediaplayer:C1MediaPlayer>_
and _</c1mediaplayer:C1MediaPlayer>_
tags:
<c1mediaplayer:C1MediaItem MediaSource="http://download.componentone.com/pub/Videos/Trevor%20Does%20Silverlight.wmv" Title="Trevor Does Silverlight" Name="C1MediaPlayer1" />
Run the program and observe that content is loaded into the control.
In Code
To add video content using code, complete the following steps:
Open the Window1.xaml.cs page and import the following namespace:
Imports C1.WPF.MediaPlayer
using C1.WPF.MediaPlayer;
Place the following code beneath the InitializeComponent() method:
'Create a C1MediaItem object
Dim C1MediaItem1 As New C1MediaItem()
'Create a Uri object that contains the media file's path
Dim Uri1 As New Uri("http://download.componentone.com/pub/Videos/Trevor%20Does%20Silverlight.wmv")
'Set the C1MediaItems content source to the Uri object
C1MediaItem1.MediaSource = Uri1
'Name the media item
C1MediaItem1.Title = "Trevor Does Silverlight"
'Add the media item to the media player
C1MediaPlayer1.Items.Add(C1MediaItem1)
//Create a C1MediaItem object
C1MediaItem C1MediaItem1 = new C1MediaItem();
//Create a Uri object that contains the media file's path
Uri Uri1 = new Uri("http://download.componentone.com/pub/Videos/Trevor%20Does%20Silverlight.wmv");
//Set the C1MediaItems content source to the Uri object
C1MediaItem1.MediaSource = Uri1;
//Name the media item
C1MediaItem1.Title = "Trevor Does Silverlight";
//Add the media item to the media player
c1MediaPlayer1.Items.Add(C1MediaItem1);
Run the program and observe that content is loaded into the control.