tag:blogger.com,1999:blog-5280710301280348838.post2515198302375107957..comments2023-09-05T06:19:29.538-07:00Comments on Developers 42: Adventures while building a Silverlight Enterprise application part #4Jonathan van de Veenhttp://www.blogger.com/profile/15269789903353187250noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-5280710301280348838.post-80852379394687165482011-03-16T00:27:24.047-07:002011-03-16T00:27:24.047-07:00Hi Dave,
You can use the Resources.Add method for...Hi Dave,<br /><br />You can use the Resources.Add method for this. You simply pass in a key and and instance of your value converter. It would look something like this:<br /><br />Resources.Add("myValueConverter", new SomeValueConverter());<br /><br />HTH.<br />JonathanJonathan van de Veenhttps://www.blogger.com/profile/15269789903353187250noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-39067482735691407452011-03-15T10:50:51.315-07:002011-03-15T10:50:51.315-07:00Hi Jonathan,
You're post really helped me out...Hi Jonathan,<br /><br />You're post really helped me out as I was having the same problem. Thanks so much! Now you mentioned in your post that: <br /><br />"If you need to load other resources besides the localized strings, you should do so from code, by adding them to the Resources instance."<br /><br />I actually have Value Converters that need to be used in the DataGrid and they are currently being loaded as a resource in the XAML file. How would I go about loading this resource in the code?<br /><br />Thanks.<br /><br />Dave.Davehttps://www.blogger.com/profile/02274746835930067720noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-78798106867561158242009-03-02T23:20:00.000-08:002009-03-02T23:20:00.000-08:00Hi Andre,You would be absolutely right. The call t...Hi Andre,<BR/>You would be absolutely right. The call to InitializeComponents and, in effect, a call to Application.LoadComponent, would result in the resources to be cleared out, even before the rest of the XAML is parsed. <BR/><BR/>I've been digging into the framework source, but couldn't find where they do this. But I did end up with native API calls, so maybe it's in mscorelib.<BR/><BR/>Thanks for the heads up.<BR/><BR/>Greets,<BR/>JonathanJonathan van de Veenhttps://www.blogger.com/profile/15269789903353187250noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-2333956989186419512009-03-02T11:31:00.000-08:002009-03-02T11:31:00.000-08:00when you got resources defined in your xaml, theyl...when you got resources defined in your xaml, theyll wipe off your localizations. to prevent this, you have to assign them in the code behind after the LoadLocalStrings method call.Unknownhttps://www.blogger.com/profile/05921851142716066193noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-81510040782106698092009-01-19T05:00:00.000-08:002009-01-19T05:00:00.000-08:00Thanks, Jonathan. I was stuck with the DataGrid is...Thanks, Jonathan. I was stuck with the DataGrid issue the whole day until I found your valuable post. You save the day ;)<BR/><BR/>Emil Stoychev<BR/>SilverlightShow.netEmil Stoychevhttps://www.blogger.com/profile/05236936612403096706noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-55872177586130139042009-01-16T00:58:00.000-08:002009-01-16T00:58:00.000-08:00Ah, sorry about that. I've repackaged the project ...Ah, sorry about that. I've repackaged the project and uploaded it again. It should be complete now.<BR/>Thanks for telling me.<BR/><BR/>Greets,<BR/>JonathanJonathan van de Veenhttps://www.blogger.com/profile/15269789903353187250noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-57247410860535596032009-01-16T00:51:00.000-08:002009-01-16T00:51:00.000-08:00Jonathan, i'm sorry, but "ComboLookup.zip/ComboLoo...Jonathan, i'm sorry, but "ComboLookup.zip/ComboLookup\ComboLookup\" contains only \Bin, App.xaml.cs and App.xaml :(<BR/><BR/>I would like to see complete client project with Page.xaml.cs, resx-files..<BR/><BR/>Thanks.vhttps://www.blogger.com/profile/03985570355421344176noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-41840221312585281322009-01-15T23:22:00.000-08:002009-01-15T23:22:00.000-08:00Hi, you can download the ComboLookup.zip. Inside i...Hi, you can download the ComboLookup.zip. Inside is an example solution that contains the files you're looking for.<BR/><BR/>Greets,<BR/>JonathanJonathan van de Veenhttps://www.blogger.com/profile/15269789903353187250noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-88039860923015700902009-01-15T06:30:00.000-08:002009-01-15T06:30:00.000-08:00Jonathan, can you publish client code of solution ...Jonathan, can you publish client code of solution (Page.xaml.cs, resx-files, ..) ?<BR/><BR/>Thanks.vhttps://www.blogger.com/profile/03985570355421344176noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-33213941679161293802009-01-15T05:15:00.000-08:002009-01-15T05:15:00.000-08:00Thanks for sharing, I might try that. The thing is...Thanks for sharing, I might try that. The thing is that I worked around my issues and now I can do the cool stuff, so I don't feel like going back to localization for the moment... But if I have to, I'll keep in mind your advice.Annahttps://www.blogger.com/profile/03687828009823314561noreply@blogger.com