public DefaultValueMapping(IDictionary <string, object> defaultValues)
 {
     Debug.Assert(defaultValues != null);
     _defaultValues = defaultValues;
     // Build a custom type descriptor which will act as a lightweight wrapper around the dictionary.
     Instance = new DictionaryCustomTypeDescriptor(defaultValues);
 }
        public override object GetValue(object component)
        {
            // Try to cast the component to a DictionaryCustomTypeDescriptor and get the value in the dictonary
            //  that corresponds to this property
            DictionaryCustomTypeDescriptor typeDescriptor = component as DictionaryCustomTypeDescriptor;

            if (typeDescriptor == null)
            {
                return(null);
            }

            return(typeDescriptor.GetValue(Name));
        }
 public DefaultValueMapping(IDictionary<string, object> defaultValues) {
     Debug.Assert(defaultValues != null);
     _defaultValues = defaultValues;
     // Build a custom type descriptor which will act as a lightweight wrapper around the dictionary.
     Instance = new DictionaryCustomTypeDescriptor(defaultValues);
 }