How to add entries to ResourceDirectory in WPF using C# ?

Below is a sample code snippet demonstrating how the entries can be added to the ResourceDirectory in WPF application using C#.

How to add entries to ResourceDirectory in WPF using C# ?

System.Windows.ResourceDictionary resourceDirectoryGK = new System.Windows.ResourceDictionary();
System.Windows.Media.Color GKColor1 = System.Windows.Media.Colors.White;
System.Windows.Media.Color GKColor2 = System.Windows.Media.Colors.Black;
resourceDirectoryGK.Add("1", GKColor1);
resourceDirectoryGK.Add("2", GKColor2);

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply


Interesting BlogPosts to read

Extended WPF Toolkit - 2.8.0
What's new in v2.8 Community Edition? (Released May 6, 2016) Hot on the heels of last month's v2.7.0...
What is WinFX ?
WinFX was the codename that was set for some of the technologies that was introduced with .NET 3.0 l...
Replacing Multiple spaces with single space in C#
Are you looking at an sample demonstrating the usage of the regular expression to replace multiple s...