Property expansion and notify parent with custom data factory.

Grids for WPF Forum

Posted 8 years ago by Stuart James
Version: 15.1.0624

I have a question regarding using a custom DataFactory and getting expanded properties to notify there parent on edit.

Quick outline. My custom DataFactory implements GetProperties() and correctly creates a custom DataAccessor for each property I wish to display. I create everything in code, since I want to control the string localisation and categories very closely, and I am using a simple custom DataAccessor.

Here is an example of the situation:

public class MyObjectViewModel
public MyPointViewModel Coord { get; } // this can be expanded into X/Y

I account for all MyObjectViewModel properties, MyPointViewModel as a property and all MyPointViewModels properties in GetProperties(), and create a relevant DataAccessor for each.

MyPointViewModel looks roughly as follows:

public class MyPointViewModel
public int X { get; set; }

public int Y { get; set; }

public string ToString()

 I decorated the X/Y properties to notify the parent on update (also created DataAccessors for X/Y in GetProperties()).

This does not update the parent property, and I think I know why. When I create the DataAccessors for X/Y I do not set the Parent property (can not see a way to set it other than one particular constructor I dont know how to use). If I allow a TypeDescriptor factory to create properties I see this field set.

So, my questions are:

1) Is my assumption about the problem correct?
2) If so, how can I set this field when I create my DataAccessor so NotifyParentProperty works correctly?
3) If this can not be done, how can I solve this in my framework?

Thanks for your time

[Modified 8 years ago]

Comments (2)

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

Hi Stuart,

Yes, it will look at the NotifyParentProperty attribute, but only if the data accessor's Parent is set.  The Parent property should be virtual, so if you have a class that inherits one of the property data accessor classes, you could override that property and add a way to provide the value it returns.  That would solve your problem.

Actipro Software Support

Posted 8 years ago by Stuart James

Perfect, thanks, working as I want it now! Somehow missed that Parent was virtual in the documents.

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

Add Comment

Please log in to a validated account to post comments.