Set custom CategoryName and Description for CustomFactory.

Grids for WPF Forum

Posted 10 years ago by Sasha
Version: 14.2.0610


I've created Custom factory(like in tutorial) for my propertyGrid and it's working good:

 protected override IList<IPropertyDataAccessor> GetProperties(object value, DataFactoryOptions options)
     IList<IPropertyDataAccessor> dataAccessors;

     var room = value as CustomDocumentWindowViewModel;
     if (room != null)
         // Create a list of property data accessor results
         dataAccessors = new List<IPropertyDataAccessor>();

         // Add room name
         dataAccessors.Add(new CustomPropertyDataAccessor<CustomDocumentWindowViewModel, string>(room, o => o.Title, (string)Application.Current.Resources["TabName"], null));

         // Add room image path
         dataAccessors.Add(new CustomPropertyDataAccessor<CustomDocumentWindowViewModel, string>(room, o => o.ImagePath, (string)Application.Current.Resources["ImagePath"], null));
         // Fall back to using the base method's results for nested objects
         dataAccessors = base.GetProperties(value, options);

     return dataAccessors;

 But also I would like to set Category and Description for each property. Setting via attribute [Category("")] is not working. I am not sure how should I do that. Can you please explain, what should I do or give me a link, where I can see some example.

Thanks you.

Comments (1)

Answer - Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Sasha,

If you are using the CustomPropertyDataAccessor from our CustomFactory QuickStart, the easiest way to add a category/description would be to override CategoryInternal and DescriptionInternal similar to how we do the DisplayNameInternal override.  Then also accept those values in the constructor like we do with 'displayName'.  Store the category and description in fields (like with displayName) and return them in the CategoryInternal and DescriptionInternal overrides.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.