In a WPF application, I load in xaml files with the xamlreader by finding the current directory like this:
public static string GetApplicationDirectory()
{
return System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
so I can read in a .xaml file by getting its absolute path like this:
string pathAndFileName = GetApplicationDirectory() + @"\Layouts\LayoutMain.xaml";
in Silverlight the GetDirectoryName(...) method gives me a MethodAccessException.
How to can I read in these .xaml resource dictionary files that are located relative to the .xap file in Silverlight?
I can imagine I could have a directory under where my .xap file is placed called "Layout" with my .xaml files in it that I could read, but what would be the Silverlight command to read in this .txt file relative to the URI at which the .xap file happens to be placed?