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
{
[NotifyParentProperty(true)]
public int X { get; set; }
[NotifyParentProperty(true)]
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 9 years ago]