public override bool GetPropertiesSupported(ITypeDescriptorContext context) { var attr = context.GetAttribute <ExpandableAttribute>(); return(attr != null ? attr.IsExpandable : base.GetPropertiesSupported(context)); }
//public static string ConvertValueToString<T>(this ITypeDescriptorContext context, T value) //{ // var pd = context.PropertyDescriptor; // var attrs = pd.Attributes; // if(pd is DictPropertyDescriptor<int, T> dpd) // { // } //} public static bool TryCanEditFrom(this ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { var editable = context.GetAttribute <EditablePropertyAttribute>(); if (editable != null) { return(true); } //if (context?.PropertyDescriptor is DictPropertyDescriptor<int, T> pd) // if (context.Instance is IReadOnlyDictionary<int, T> dict) // return true; } return(false); //if (sourceType == typeof(string)) return true; }