"By deriving from TypeDescriptorFactory or TypeReflectionFactory, the custom factory can customize the items or properties already generated by these factories. Such as adding or removing properties, categories, or category editors, or rearranging the items."
Is it possible to sort like this? If so, what am I doing wrong? I am including my derived class -- it's very simple:
---------------------------------------------------
public class ExtendedTypeDescriptorFactory : TypeDescriptorFactory
{
protected override IList<IPropertyDataAccessor> GetProperties(object value, DataFactoryOptions options)
{
var p = base.GetProperties(value, options);
if (p == null) return null;
var result = new List<IPropertyDataAccessor>(p.OrderBy(prop =>
{
var rank =
(Window1.SortOrderAttribute)
value.GetType().GetProperty(prop.ValueName).GetCustomAttributes(false).
FirstOrDefault(x => x.GetType().Equals(typeof (Window1.SortRankAttribute)));
return (rank == null) ? 0 : rank.Rank;
}));
return result;
}
}