/// <summary> /// Converts the specified collection into an array of values. /// </summary> /// <param name="editValue">The collection to edit.</param> /// <returns>An array of values.</returns> protected override object[] GetItems(object editValue) { if (editValue is CssCollection) { CssCollection col = (CssCollection)editValue; object[] values = new object[col.Keys.Count]; for (int i = 0; i < col.Keys.Count; i++) { string key = col.Keys[i]; values[i] = new CssAttribute(key, col[key]); } return(values); } return(new object[0]); }
/// <summary> /// Converts an array of items back into a collection. /// </summary> /// <param name="editValue">The collection to edit.</param> /// <param name="value">The array of values.</param> /// <returns>The editted collection.</returns> protected override object SetItems(object editValue, object[] value) { if (editValue is CssCollection) { CssCollection col = (CssCollection)editValue; col.Clear(); for (int i = 0; i < value.Length; i++) { CssAttribute attrib = (CssAttribute)value[i]; if ((attrib.Attribute != String.Empty) && (attrib.Value != String.Empty)) { col.Add(attrib.Attribute, attrib.Value); } } } return(editValue); }
/// <summary> /// Converts the specified collection into an array of values. /// </summary> /// <param name="editValue">The collection to edit.</param> /// <returns>An array of values.</returns> protected override object[] GetItems(object editValue) { if (editValue is CssCollection) { CssCollection col = (CssCollection)editValue; object[] values = new object[col.Keys.Count]; for (int i = 0; i < col.Keys.Count; i++) { string key = col.Keys[i]; values[i] = new CssAttribute(key, col[key]); } return values; } return new object[0]; }