我有一个comboBox,然后一个MediaElement.....然后就是想通过下拉列表框选择,可以在播放不同的视屏。。 me.Source = new Uri(ListData[i].mvUrl.ToString());但是到这里就有问题了,一直说URI格式不对。。。求高手解答。。。
我的代码: List<move> ListData = new List<move>();
public MainPage()
{
InitializeComponent();
ListData.Add(new move { mvUrl = "/SilverlightApplication1;component/media/01.wmv", note = "笑话" });
ListData.Add(new move { mvUrl = "/SilverlightApplication1;component/media/kobe.wmv", note = "篮球比赛" });
cbMovie.DataContext = ListData;
cbMovie.SelectedIndex = 0;
}
public class move
{
public string mvUrl { get; set; }
public string note { get; set; }
}
private void cbMovie_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int i = cbMovie.SelectedIndex;
me.AutoPlay = true;
me.Source = new Uri(ListData[i].mvUrl.ToString());
me.Play();
}
url里面不能有“;”
把你的地址的格式弹出来,看对不对
url需要带上http://
举个例子。。
@5apple:
http://你的域名/SilverlightApplication1/component/media/01.wmv