internal static ButtonResources FindButton(String buttonName, CultureInfo culture) { if (String.IsNullOrEmpty(buttonName)) { throw new ArgumentException("The name of the button cannot be Null or Empty", "buttonName"); } ButtonResources buttonResources; // Check whether the requested resource has been loaded yet. if (resourceDictionary.ContainsKey(buttonName)) { buttonResources = resourceDictionary[buttonName]; } else { // Create a new instance with the requested name. buttonResources = new ButtonResources(buttonName); // Load the object's properties from the Resources. buttonResources.LoadResources(culture); // Add the new object to the dictionary. resourceDictionary.Add(buttonName, buttonResources); } return(buttonResources); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { // Use the ButtonResources helper to find the brush to use for the button. return(ButtonResources.FindButton(value as String, culture).Brush); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { // Use the ButtonResources helper to find the image to put on the button. return(ButtonResources.FindButton(value as String, culture).Image); }