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:
<c1mediaplayer:C1MediaPlayer>
and </c1mediaplayer:C1MediaPlayer>
tags:
XAML |
Copy Code
|
---|---|
<c1mediaplayer:C1MediaItem MediaSource="http://download.componentone.com/pub/Videos/Trevor%20Does%20Silverlight.wmv" Title="Trevor Does Silverlight" Name="C1MediaPlayer1" /> |
In Code
To add video content using code, complete the following steps:
Visual Basic |
Copy Code
|
---|---|
Imports C1.WPF.MediaPlayer
|
C# |
Copy Code
|
---|---|
using C1.WPF.MediaPlayer;
|
Visual Basic |
Copy Code
|
---|---|
'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) |
C# |
Copy Code
|
---|---|
//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); |