Autogenerating xaml ResourceDictionary

I have an application in which I use a specific ResourceDictionary for my strings, and I need to duplicate the keys of this ResourceDictionary in the class as string constants. Although it’s easy to simply copy and paste, I expect about 350 lines of resources, and managing both files that have all the content is not an option.

I want to encode an application that will have a Key / Value grid for which the user will enter values, and this application will write in the Xaml file and in the constant .cs class. I have no problem with the .cs file, but is there a way to write to the xaml file without having to clear the file before writing the contents of the new file?

thank

+3
source share
2 answers

You can write a T4 template that uses a simple WPF usercontrol or xml file to create xaml and C # files.

Excellent T4 tutorials from Oleg Sych

Here's how to create multiple files with T4

+4
source

I use ReSharper 7 beta in VS11 (although older versions have the same functionality) to create a template that at least helps reduce the required keystrokes.

+1
source

All Articles