1. for example
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Test">
<SolidColorBrush x:Key="Brush1" Color="Green"/>
</ResourceDictionary>
ResourceDictionary dict = new ResourceDictionary();
dict.Source = new Uri("pack://application:,,,/TestDictionary.xaml");
Brush brush1 = dict["Brush1"] as SolidColorBrush;
2. You cannot use SystemResourceKeys, they are internal, but you can probably reuse the keys from the SystemColors class to create your dictionary, it really does not matter what you use, the key can be any object, this question may be of interest.
source
share