I have a specific data set that requires storing data that is both grouped and ordered. Each row then needs to be able to recalculate it's sums whenever any individual item changes.
This is the basic look of the end result:
The object structure is as such:
public class MyObject : INotifyPropertyChanged
{
public ObservableCollection<MySubObject> Objects { get; set; }
public Decimal TotalOfAll { get; set; }
/* Ommited INPC and other properties for brevity */
}
public class MySubObject : INotifyPropertyChanged
{
public Decimal Value { get; set; }
public String RowType { get; set; }
/* Ommited INPC and other properties for brevity */
}
The view needs to bind to MyObject, then group the Objects property by it's Type property.
Now, I've already accomplished this without using reactive extensions, but it feels hackish...I would like to accomplish this by converting the Objects property of MyObject to an observable which should, in theory, allow me to update the sums whenever the Value property of MySubObject changes.
I already have the view side of things built, so that's not the issue...it's getting the RX part completed.
NOTE:
I can alternatively expose my data like this:
public class MyObject : INotifyPropertyChanged
{
public ObservableCollection<MyRowObject> Objects { get; set; }
public Decimal TotalOfAll { get; set; }
/* Ommited INPC and other properties for brevity */
}
public class MyRowObject : INotifyPropertyChanged
{
public ObservableCollection<MySubObject> Objects { get; set; }
public String RowType { get; set; }
public Decimal RowTotal { get; set; }
/* Ommited INPC and other properties for brevity */
}
public class MySubObject : INotifyPropertyChanged
{
public Decimal Value { get; set; }
/* Ommited INPC and other properties for brevity */
}
This would take care of the grouping issue, but I still cannot get it to work