How to display a resource dictionary items in design view?

497 Views Asked by At

I want to display my resource dictionary items with my custom design view, i want to make a ListView to show the keys with the values. and can edit withing the design view. -i want to be able to edit my dictionary within visual studio desiner.

i want to be able to edit my dictionary within visual studio desiner

1

There are 1 best solutions below

1
Abdurrahman Alp Köken On

I think you can use Keys and Values properties of resourceDictionary instance below.

 string exeFilePath = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
 string exeDirPath = System.IO.Path.GetDirectoryName(exeFilePath);
 string targetFile = "subFolder\\ResourceDictionary.xaml";
 string dictionaryPath = new Uri(System.IO.Path.Combine(exeDirPath, targetFile)).LocalPath;
 string xamlString = File.ReadAllText(dictionaryPath);
 ResourceDictionary resourceDictionary = (ResourceDictionary)XamlReader.Parse(xamlString);