public string GetValue(string name) { StyleState state = ResolveState(); string value = null; Component component = _component; while (value == null) { string[] styles = GetStyleArray(component.Style); bool isInheritable = StyleValueResolver.IsValueInheritable(name); for (int i = styles.Length - 1; i >= 0; i--) { value = StyleBank.GetClass(styles[i]).GetValue(name, state, (!isInheritable && i > 0) ? true : false); if (value != null) { break; } } if (isInheritable && component.Parent != null) { component = component.Parent; } else { break; } } if (value == null) { StyleValue styleValue = StyleValueResolver.Get(name); if (styleValue != null) { value = styleValue.Value; } else { value = string.Empty; } } return(value); }
public void SetValue(string name, string value) { if (Contains(name)) { foreach (var val in _values) { if (val.Name == name) { val.Value = value; } } } else { StyleValue val = StyleValueResolver.Get(name, value); if (val != null) { _values.Add(val); } } }
private void Load(XmlNode node) { if (node.Attributes["state"] != null) { State = (StyleState)Enum.Parse(typeof(StyleState), node.Attributes["state"].InnerText, true); } if (node.Attributes["name"] != null) { Name = node.Attributes["name"].InnerText; } foreach (XmlNode prop in node.ChildNodes) { StyleValue value = StyleValueResolver.Get(prop.Name, prop.InnerText); if (value != null) { _values.Add(value); } } }