|
Here is Page.Xaml
mediaelement source="1.mp3" width="354" height="265" canvas.left="10" canvas.top="174" >
|
|
|
|
|
Hello Bilal,
Your XAML tag is unreadable. Please check "Ignore HTML tags in this message (good for code snippets)" when you are posting the code.
|
|
|
|
|
Hi i am a beginner in WPF.
I am getting following error when i run the application
A"ppname.exe encounterd a problem and need to be closed" i have set the size of media element but still getting the error.
There iz only one control on the WPF form.
|
|
|
|
|
|
Thank You Jam for posting the Solution.
When i opened the solution in Expression Blend It again gives same error.
Either it is a windows media player error or i shold open it with VS220.
thanks.
|
|
|
|
|
I don't get any errors here opening my solution in either VS2008 / VCSharp Express 2008 / Expression Blend ... can you play the file normally through WMP?
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi All'
I am Using A flow Document Control in My Application.So Whenever I add Text Its Scroll Going to up and I cannot see last item I added.I HAve to scroll and See the last item added.Any Solution
Thanks in Advance.
|
|
|
|
|
I've searched all over Codeproject, and on google, but i can't figure out how to insert a source into the Media Element from a listbox with the media file name on it.
Even though this is an extremely vague bad question, can someone help me out with this matter.
|
|
|
|
|
assuming your listboxitem is of type string you should do:
myMediaElement.Source = new Uri(myListBox.SelectedItem.ToString());
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Don't understand the concept of strings yet, so i highly doubt it is one.
I'll try this nonetheless
Ok Modified:
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="Bleach Player"
StackTrace:
at WpfApplication1.Window1.ListBoxItem_Selected(Object sender, RoutedEventArgs e) in C:\Documents and Settings\Nick\My Documents\Visual Studio 2008\Projects\Bleach Player\Bleach Player\Window1.xaml.cs:line 61
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.Controls.ListBoxItem.OnSelected(RoutedEventArgs e)
at System.Windows.Controls.ListBoxItem.OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at System.Windows.Markup.BamlRecordReader.SetDependencyValueCore(DependencyObject dependencyObject, DependencyProperty dependencyProperty, Object value)
at System.Windows.Markup.BamlRecordReader.SetDependencyValue(DependencyObject dependencyObject, DependencyProperty dependencyProperty, Object value)
at System.Windows.Markup.BamlRecordReader.ReadPropertyCustomRecord(BamlPropertyCustomRecord bamlPropertyRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
InnerException:
modified on Friday, June 6, 2008 7:25 PM
|
|
|
|
|
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)
{
string mySelectedFilePath = myListBox.SelectedItem.ToString();
myMediaElement.Source = new Uri(mySelectedFilePath);
}
}
Don't be overcome by evil, but overcome evil with good
modified on Friday, June 6, 2008 8:06 PM
|
|
|
|
|
Still not getting this to work out right, i figured out I'm missing the mySelectedFilePath . And if i leave as is, no song plays/it adds the same thing into the list over and over and over (if you keep selecting it)
Trying to switch things around to see if it works but still has been giving the same errors as before.
And i can't show you the code to what i had before, i switched it to see if it would work as you said you would do. Accidentally saved after changes (habit)
|
|
|
|
|
Hi Nick,
Its going to be really hard for anyone to help you further unless you post the code you *are* using. A string is CHARACTER based type ...
1 = numeric
"1" = string
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
C# Beginner Nick wrote: Still not getting this to work out right, i figured out I'm missing the mySelectedFilePath. And if i leave as is, no song plays/it adds the same thing into the list over and over and over (if you keep selecting it)
You must be adding adding the songs to the listbox in the wrong place.
C# Beginner Nick wrote: Trying to switch things around to see if it works but still has been giving the same errors as before.
Instead of switching things around to "try" to get it to work, you really need to read a good book. My Favorites are:
Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition[^] - This helps understand C#
Pro WPF[^] - This is geared more for wpf.
C# Beginner Nick wrote: And i can't show you the code to what i had before, i switched it to see if it would work as you said you would do. Accidentally saved after changes (habit)
Without any code, i have no clue on what your doing. So its real hard to help you further
|
|
|
|
|
Alright, I've been trying to save money for some books, but money nowadays goes by to fast.
Thanks,
And to the other guy, i changed my code to what teejayem said he would try, so what his code is, is what my code was before i tried to start over.
|
|
|
|
|
I've made a complete solution for you ... have a look at this to see how to do what you want.
PlayMediaElement from Listbox[^]
Change the directory in the source code to somewhere you know you have .avi files and then build it and run it ...
alternatively you could change the extension from "*.avi" to "*.mp3"
You've not picked a simple task to start with really. MediaElement is a tempramental beast!!
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I usually hate starting off easy, medium is fine.
Thanks, i'll take a look at it.
|
|
|
|
|
Hi,
In my project, there is a requirement to consume STORM control into XAML page. Is XAML support any third party custom control (Other than WPF control)? If yes, how to consume it?
Greatly appreciate any help..
Thanks in advance
Best Regards,
Anand.
|
|
|
|
|
Have a look into the WPF WindowsFormsHost control ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi.
I am a student and working in dotnet3.5. I want to customize WPF forms for PDA's. I read many articles in which PDA's Resolution problem and its screen attributes are discussed. I want to run the Forms both Desktop and web based forms on PDA.
Second issue is related to WCF as i want ro build a wireless intranet in which 5-10 PDA's can communicate with the Application Server.
Any idea, Links,Articles would be very helpful for me.
Thanks.
|
|
|
|
|
Hey guys,
I have been developing some custom WPF UserControl's (System.Windows.Controls.UserControl -- .dll) in WPF/C#. I was wondering how I could use these custom controls inside of a webpage? Can anyone provide any examples of WPF ActiveX embedding code using HTML/JavaScript etc?
I greatly appreciate any help.
David.
|
|
|
|
|
Great question, I have been wondering this for some time but haven't gotten around to trying it. I can't find any examples online for this, but I'm sure a WPF MediaElement or other control can be embedded inside a webpage, I'm just not sure how.
madness ? this.isSparta = true : this.isSparta = false;
modified on Friday, June 6, 2008 4:47 PM
|
|
|
|
|
In the WPF window, i have a check box that i want to be checked and make the program stay up top of all others.
this.TopMost();
But i keep getting this error
Error 1 Non-invocable member 'System.Windows.Window.Topmost' cannot be used like a method. C:\Documents and Settings\Nick\My Documents\Visual Studio 2008\Projects\Bleach Player\Bleach Player\Window1.xaml.cs 36 18 Bleach Player<br />
I've tried to throw an exception and that just threw me down a long road of errors.
Anyone explain why i can't do this or use this:
<br />
if (Change.Checked)<br />
{ FormBorderStyle = FormBorderStyle.None; }<br />
else <br />
{ FormBorderStyle = FormBorderStyle.SizableToolWindow; }
To change the window border frame?
Btw, i know this is in the WPF forum, not C# as the codes above are. Before you start flaming i understand this but i am creating a WPF window not a C# program.
|
|
|
|
|
TopMost is a propterty, so try:
this.TopMost = true;
I'm assuming Change is a CheckBox, and in that case you can't do if (Change.Checked) because Checked is an event. Use IsChecked which is of type bool? (? means it is nullable as in System.Nullable):
if ((bool)Change.IsChecked)
I don't know where FormBorderStyle came from. If you're using a System.Windows.Window use
WindowStyle = WindowStyle.None;
and
WindowStyle = WindowStyle.ToolWindow;
|
|
|
|
|
Thanks, these worked, had to change TopMost to Topmost though.
modified on Friday, June 6, 2008 7:06 AM
|
|
|
|