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