/// <inheritdoc /> public override object ProvideValue(IServiceProvider serviceProvider) { var binding = new Binding { Source = Instance, Mode = BindingMode.OneWay, Path = new PropertyPath($"[{_key ?? _themeKey.ToString()}]"), }; var target = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget; var property = target?.TargetProperty as DependencyProperty; if (property?.PropertyType == typeof(Color)) { binding.Converter = Converters.BrushToColor; } return(binding.ProvideValue(serviceProvider)); }
public static object GetResource(ThemeResourceKey resourceKey) { return(ResourceDictionary.Contains(resourceKey.ToString()) ? ResourceDictionary[resourceKey.ToString()] : null); }
internal static void SetResource(ThemeResourceKey resourceKey, object resource) { SetResource(resourceKey.ToString(), resource); }