|
1) Why are you getting / setting a hidden checkbox? Thats kind of hacky. Why not do it the right way with a DP or have your ViewModel implement INPC?
2) Image.Source is an ImageSource property. What you are returning is not an ImageSource. You are returning a string.
Try something like this instead:
return new BitmapImage(new Uri("pack://application:,,,/SIMS;component/Views/image/thumbs_up.png", UriKind.RelativeOrAbsolute));
Or whatever the correct path is.
|
|
|
|
|
Well,
First off I did not ask for comments on how I have a boolean passed to my binding.
Secondly the definition of the Source field is a path to the image. In this case the strings define the path to the resource within the current active assembly. Also as stated the one image worked. Turns out that the problem was in the path to the second image. Once I removed the s from images, the image loads just fine.
Finally now that both have been tested I can then do the refactoring for proper handling of the boolean.
|
|
|
|
|
Michael J. Eber wrote: First off I did not ask for comments on how I have a boolean passed to my binding.
So if someone you asked advice from spots a lousy design you don't want to hear about it. A comment like that above will not endear you to the very people you are looking to for advice. It would have been better to acknowledge the problem and thank him for pointing it out.
I thought it was an excellent answer, fixed your problem AND pointed out a lousy design issue.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
While I don't usually support "compensating"... thanks man... that was a really retarded 1 vote . I didn't really get his rudeness / ungratefulness considering we all do this for free... but whatever. I will certainly be putting "Michael J. Eber" in my "DO NOT HELP" list.
|
|
|
|
|
Excuse me sir, but if you read my response carefully you will see that his answer was wrong and did nothing to fix my problem.
He stated my problem was that I was feeding it a string. Per documentation the Source is specifically a URI of the location.
His 'fix' was copy and pasted from the poor example posted out on MSDN. It was a wrong answer because my solution now works and all I am doing is passing the path within the assembly of the image, which is what the documentation states for that field. If he was totally correct, and source only takes a BitMapImage then I'd greatly appreciate it.
Secondly, while I was a bit short on his comments of my hack it was a statement made with no concept of what I was doing. As it turns out this screen was a prototype and we pumped in a quick and dirty way to get a functional boolean into the form.
Finally, the form was not an application form tied to a ViewModel as he assumed. It was a dialog being used by a View Model that was facing a great deal of redesign once the changing images and text were functional. Was it not a good design? Quite possibly. But it had absolutely NOTHING to do with my question.
And now, like a little child, he is running around rating everything of mine as 1. So how is not endearing themselves to people?
|
|
|
|
|
Michael J. Eber wrote: you will see that his answer was wrong and did nothing to fix my problem.
Yes I noticed that after posting - sorry.
Michael J. Eber wrote: As it turns out this screen was a
prototype and we pumped in a quick and dirty way to get a functional boolean
into the form.
That would have been a better reply in the initial response, we all hack something up when developing. I'm glad you got the problem fixed - and published it so others can benefit.
And you are right univoting is childish (although your answer on file access was incorrect and was voted on content)!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a silverlight app where the user can download the image to whereever he wants. Works fine, but now I need to save a "world file" with the image. It should be the same file name in the same path, just a different extension. However, I am unable to change the "SafeFileName" or get the path and location of the previously saved image file. I would even be willing to open a second SaveFileDialog, but I can't initialize the name of the file - or force the path. Is there any hope here?
Thanks
Brent
|
|
|
|
|
Yup, you cannot change the SaveFileName property in the dialog.
You will have to parse the directory from that name, construct your own file name/extension, and save the file manually using System.IO.File.
|
|
|
|
|
Michael J. Eber wrote: and save the file manually using System.IO.File.
I didn't think that was possible in SL.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Michael J. Eber wrote: You will have to parse the directory from that name, construct your own file name/extension, and save the file manually using System.IO.File.
Not possible except maybe for out-of-browser apps with elevated trust...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The only real way to do this is to step outside Silverlight altogether, and use JavaScript to perform the downloads. There's a good explanation on how to do this here[^].
|
|
|
|
|
Thanks,
After further searching I also found code to put all the files into one zip file. I don't think it works on all platforms (Macs for example), though.
http://slsharpziplib.codeplex.com/[^]
Brent
|
|
|
|
|
I initially considered the zip file solution, but decided against it because it adds an extra step for the end user having to unzip the files.
|
|
|
|
|
I have a Silverlight DataGrid in a DataPager and in the DataPager the DataGrid won't allow me to edit, insert, etc. Please assist.
Thanks,
Steve Holdorf
|
|
|
|
|
One other thing about my issue is that I am using an ObservableCollection but using TwoWay binding mode? Please assist.
|
|
|
|
|
Hello geeks,
I am facing a serious problem with XBAP. While performing DragDrop.DoDragDrop method it gives me System.ExecutionEngineException. this causes entire application crash. I have tried a lot but didnt worth anything.
My process is like this.
I am using wpf treeview. When I drag a treenode I am setting UIElement as DropData.
[DragDropEffects finalDropEffect = DragDrop.DoDragDrop((DraggingElement as FrameworkElement).Parent, DraggingElement, DragDropEffects.Copy);]
Now if this drag is going out of navigationWindow (IE in this case) change DropData with actual file name bound with that treeNode.
[DragDrop.DoDragDrop(this, new DataObject(DataFormats.FileDrop, new String[] { AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + ((tvMainTree.SelectedItem as TreeViewItem).Tag as Document).DocumentName + "." + ((tvMainTree.SelectedItem as TreeViewItem).Tag as Document).DocumentExtension }), DragDropEffects.Copy);]
In this case while setting the second code line I am getting System.ExecutionException. EVEN If i put direct file path in first code line and comment second line, it drops the file at targeted location but after dropping it gives the same exception. The thing was working properly before but I dont know why it is behaving strange now.
Can anybody give some guidance.
- Regards,
Bhagyesh Joshi, India.
|
|
|
|
|
hi,
I have got a clue.
it is a kind of ExecutionEngineException - EmptyReadOnlyDictionaryInternal exception.
I am getting as Data of Exception.
Now can you please give some light on this?
- Regards,
Bhagyesh Joshi, India.
|
|
|
|
|
Hi all,
I cannot run XBAP application on windows 7 with Firefox. Browser prompt me to save the file, rather displaying the content. Same happen with Chrome as well.
Searched the web and it's talking about something Net Framework Assistant 1.2, instal the addon as well and still no luck.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
|
What the hell were they thinking when they made that decision.
|
|
|
|
|
Have a read of the discussion we had on the WPF Disciples list here[^] to find out.
|
|
|
|
|
Actually I couldn't find anything related with my issue. Wonder I missed anything.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Search up the page for the following from Peter Brown (he's pretty much in charge of the WPF team):
"The XBAP model isn't really suited for public web applications: both Silverlight and HTML offer better choices there for most applications. When doing a web crawl of the public internet, I don't believe we found a single xbap in the wild. I do recall seeing demos of one or two in the past, but those were for in-store apps that ran behind a firewall.
In IE9, xbap support is turned off by default in the internet zone, and prompts (I believe) in the intranet zone. Most firefox users either didn't care to use xbaps, or simply turned off that support themselves.
This has nothing to do with the "death of WPF" and everything to do with realizing that for most applications, there are far better models than xbap. When i was a consultant, I stopped considering xbap once Silverlight came out. I now recommend Silverlight, Click Once WPF apps, or even that other popular web technology used for dancing hamsters and whatnot
WPF is an awesome client app technology. I don't really think it belongs in the browser, IMHO."
|
|
|
|
|
So is that means I cannot work with XBAP in Windows 7
I appreciate your help all the time...
CodingLover
|
|
|
|
|
You can. XBAP support for Firefox was dropped, not for IE.
|
|
|
|