diff --git a/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListItem.cs b/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListItem.cs index 1d969c9f..478042d9 100644 --- a/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListItem.cs +++ b/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListItem.cs @@ -21,12 +21,12 @@ using System; using System.Collections.Generic; using System.Linq; - +using MBS.Framework; using MBS.Framework.Collections.Generic; namespace UniversalEditor.ObjectModels.PropertyList { - public abstract class PropertyListItem : ICloneable + public abstract class PropertyListItem : ICloneable, ISupportsExtraData { public class PropertyListItemCollection : System.Collections.ObjectModel.Collection @@ -149,6 +149,35 @@ namespace UniversalEditor.ObjectModels.PropertyList public abstract void Combine(PropertyListItem item); public abstract object Clone(); + private Dictionary extraDataDictionary = new Dictionary(); + public T GetExtraData(string key, T defaultValue = default(T)) + { + if (extraDataDictionary.ContainsKey(key) && extraDataDictionary[key] is T) + { + return (T)extraDataDictionary[key]; + } + return defaultValue; + } + + public void SetExtraData(string key, T value) + { + extraDataDictionary[key] = value; + } + + public object GetExtraData(string key, object defaultValue = null) + { + if (extraDataDictionary.ContainsKey(key)) + { + return extraDataDictionary[key]; + } + return defaultValue; + } + + public void SetExtraData(string key, object value) + { + extraDataDictionary[key] = value; + } + /// /// The name of this . ///