I have looked at this posting (and others):
http://www.telerik.com/community/forums/silverlight/media-player/blend-3-cannot-create-control-template.aspx
and also the documentation about the RadMediaItem:
http://www.telerik.com/help/silverlight/radmediaplayer-radmediaitem.html
But am not sure how to do this. I loaded the project from the 1st link above in Blend 3 but it's pretty complex without any knowledge on using Blend or even if I have to.
If you can give me some pointers, I'd appreciate it. In the meantime, I will do a bit of studying on Expression Blend.
Thanks,
Gary Davis
5 Answers, 1 is accepted
Still looking for some direction.
Thanks,
Gary
We apologize for the delay reply.
For more information about how to use Telerik Silverlight controls and Expression Blend please take a look at the following article:
http://www.telerik.com/help/silverlight/radcontrols-for-silverlight-expression-blend-support.html
http://www.telerik.com/help/silverlight/extend-and-modify-builtin-themes.html
Please find attached a sample project that shows you how to place buttons to each track.
You can define some custom template like for example :
<ControlTemplate TargetType="Button" x:Key="PlayButtonTemplate">
<Grid>
<ContentPresenter />
</Grid>
</ControlTemplate>
And after that you have to set it as a template to the button in MediaPlayerItem controltemplate:
<Button x:Name="PlayButton" Height="30" HorizontalAlignment="Right"
Template="{StaticResource PlayButtonTemplate}"
VerticalAlignment="Center" Width="25">
<Path Fill="#FFFFFFFF" Stretch="Fill" Data="M0,0 L50,25 L50,25 L0,50 z" />
</Button>
I hope that this will help you.
Please let us know if you have any other questions.
All the best,
Boryana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Like, what makes the Play button play? I don't see an event connected to that button.
Thanks,
Gary
Here's a question based on your example. How do I add items to the playlist in code-behind? For example:
var item = new RadMediaItem();
item.Source = new Uri(mediaSource, UriKind.RelativeOrAbsolute);
item.Title = title;
item.Description = description;
radMediaPlayer1.Items.Add(item);
This works but does not use your template. The two rows added declaritively use your template and the third added with the above code does not. The declaritive code from your example is:
<telerikMediaPlayer:RadMediaItem VideoStretch="Fill"
Template="{StaticResource MediaItemTemplate}"
Source="http://mschnlnine.vo.llnwd.net/d1/ch9/4/6/3/9/0/4/CSharp4DesignTeam_ch9.wmv"
Title="C# 4.0: Meet the Design Team"
Description="Anders Hejlsberg, Eric Lippert, Paul Vick..." />
I could not figure out how to specify the template in the code behind.
Thanks,
Gary
Please find attached a sample project that shows how to dynamically add RadMediaItems to the RadMediaPlayer using the custom created template:
private void Button_Click(object sender, RoutedEventArgs e)
{
string mediaSource = @"http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/BCT06.wmv";
ControlTemplate mediaItemCustomTemplate = this.Resources["MediaItemTemplate"] as ControlTemplate;
var item = new RadMediaItem();
item.Template = mediaItemCustomTemplate;
item.Source = new Uri(mediaSource, UriKind.RelativeOrAbsolute);
item.Title = "Test added Item";
item.Description = "Decription of the item";
radMediaPlayer1.Items.Add(item);
}
As to the question about the play button "PlayButton" is a part of the build in RadMediaItem functionality.
This means that setting Template="{StaticResource PlayButtonTemplate}" only change the appearance of the button but not its functionality.
I hope that this will help you.
All the best,
Boryana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.