Click here to Skip to main content
15,920,111 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Error in Plyaing video using Media Element Pin
Jammer9-Jun-08 0:33
Jammer9-Jun-08 0:33 
GeneralRe: Error in Plyaing video using Media Element Pin
bilal haider11-Jun-08 1:21
bilal haider11-Jun-08 1:21 
GeneralRe: Error in Plyaing video using Media Element Pin
Jammer11-Jun-08 9:19
Jammer11-Jun-08 9:19 
QuestionFLowDocument Viewer In WPF Pin
SHINOJK8-Jun-08 12:55
SHINOJK8-Jun-08 12:55 
QuestionMedia Element Help Pin
C# Beginner Nick6-Jun-08 6:52
C# Beginner Nick6-Jun-08 6:52 
AnswerRe: Media Element Help Pin
teejayem6-Jun-08 10:12
teejayem6-Jun-08 10:12 
GeneralRe: Media Element Help [modified] Pin
C# Beginner Nick6-Jun-08 13:19
C# Beginner Nick6-Jun-08 13:19 
GeneralRe: Media Element Help [modified] Pin
teejayem6-Jun-08 13:46
teejayem6-Jun-08 13:46 
could you please post the code where you are adding the source of the mp3 file to the listbox?

also if there isn't an item selected then the "SelectedItem" property will be null and in return throw the exception that you posted

EDIT:

this is how i would do it.

I'm not sure how your getting the file path, but if the filepath is a string then you would add it to the listbox like this:
string myFilePath = @"C:\myMp3\Soundgarden - Some Song.mp3";
myListBox.Items.Add(myFilePath);




then i would hook the ListBox.MouseDoubleClick. This will fire when a user doubleclicks on a song

private void myListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
    if (myListBox.SelectedItems.Count > 0) //Make sure there is at least one selected item
    {
        string mySelectedFilePath = myListBox.SelectedItem.ToString();  //Get the selected file path from the listbox
        myMediaElement.Source = new Uri(mySelectedFilePath); //add it to the media element source
    }
}


Don't be overcome by evil, but overcome evil with good

modified on Friday, June 6, 2008 8:06 PM

GeneralRe: Media Element Help Pin
C# Beginner Nick6-Jun-08 16:16
C# Beginner Nick6-Jun-08 16:16 
GeneralRe: Media Element Help Pin
Jammer7-Jun-08 0:15
Jammer7-Jun-08 0:15 
GeneralRe: Media Element Help Pin
teejayem7-Jun-08 4:27
teejayem7-Jun-08 4:27 
GeneralRe: Media Element Help Pin
C# Beginner Nick7-Jun-08 5:58
C# Beginner Nick7-Jun-08 5:58 
GeneralRe: Media Element Help Pin
Jammer7-Jun-08 7:37
Jammer7-Jun-08 7:37 
GeneralRe: Media Element Help Pin
C# Beginner Nick8-Jun-08 14:46
C# Beginner Nick8-Jun-08 14:46 
QuestionIs XAML support any third party custom control (Other than WPF control)? If yes, how to consume it? Pin
sivanand5-Jun-08 23:45
sivanand5-Jun-08 23:45 
AnswerRe: Is XAML support any third party custom control (Other than WPF control)? If yes, how to consume it? Pin
Jammer5-Jun-08 23:57
Jammer5-Jun-08 23:57 
QuestionWPF Forms for PDA and Communication between PDA and Application server in intranet. Pin
bilal haider5-Jun-08 19:47
bilal haider5-Jun-08 19:47 
QuestionHow do I embed WPF Custom UserControl (.dll) into a Webpage? Pin
dsanghera5-Jun-08 18:11
dsanghera5-Jun-08 18:11 
GeneralRe: How do I embed WPF Custom UserControl (.dll) into a Webpage? [modified] Pin
K.L.K6-Jun-08 9:28
K.L.K6-Jun-08 9:28 
QuestionTopmost control error Pin
C# Beginner Nick5-Jun-08 15:30
C# Beginner Nick5-Jun-08 15:30 
AnswerRe: Topmost control error Pin
Brian Griggs5-Jun-08 17:31
Brian Griggs5-Jun-08 17:31 
GeneralRe: Topmost control error [modified] Pin
C# Beginner Nick6-Jun-08 1:00
C# Beginner Nick6-Jun-08 1:00 
QuestionWCF exeption?????? Pin
Romiks5-Jun-08 8:00
Romiks5-Jun-08 8:00 
AnswerRe: WCF exeption?????? Pin
Brian Griggs5-Jun-08 8:46
Brian Griggs5-Jun-08 8:46 
GeneralRe: WCF exeption?????? Pin
Romiks5-Jun-08 21:19
Romiks5-Jun-08 21:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.