public static PropertyDescriptorCollection GetPropertiesOf(Type type) { Type itemType = TypeService.GetItemType(collectionType: type); if (itemType != null) { type = itemType; } IVMDescriptor childDescriptor = ClassDescriptorAttribute .GetClassDescriptorOf(type); if (childDescriptor != null) { var browsableDescriptors = childDescriptor .GetPropertyDescriptors() .OfType <ViewModelPropertyDescriptor>() .Select(actual => new BrowsablePropertyDescriptor(actual)) .ToArray(); return(new PropertyDescriptorCollection(browsableDescriptors)); } return(TypeDescriptor.GetProperties(type)); }
private static void RequireClassDescriptorAttributeOnItemType() { // TODO: Clean up? IVMDescriptor classDescriptor = ClassDescriptorAttribute.GetClassDescriptorOf(typeof(T)); if (classDescriptor == null) { throw new ArgumentException(EViewModels.BrowsableListRequiresClassDescriptorAttribute); } }