I want to embed a dictionary file as a resource into my project so that it's part of the application instead of just a separate file. The function to load the dictionary will take either a URi or a string as the path to the file. (Example: spellChecker.MainDictionary.LoadAsync(URiToMyDictionaryFile);
).
How do I access a file set as "resource" or "embedded resource"? Also, what' the difference between the two?
The goal is just to have the file as part of the application so I don't have to worry about making sure it's included when the app is distributed.
Thanks again!
-Sootah
The difference between "Embedded Resource" and a "Resource" from Silverlight's point of view is that Silverlight can't access an "Embedded Resource" so don't use it.
To access a file added to the dll assembly as a "Resource" you need to add the name of the assembly plus ";component" as the first element of the Uri that accesses it:-
spellChecker.MainDictionary.LoadAsync(new Uri("/yourProjectName;component/yourDictionary.dic",UriKind.Relative));
If you are building a XAP (that is you're not creating a Silverlight library) then have you considered using "Content" instead of "Resource". This includes the file as part of the XAP alongside the dll rather than storing it in the dll.