Hi,
I have some problem to refresh value on column who depend of child item.
My model is define in the sample.
I would like to have the Sum of Qty delivery for each items
I tried something like this :
<ig:XamGrid x:Name="ControleGrid"
Width="auto"
ItemsSource="{Binding Items}"
AutoGenerateColumns="False"
IsAlternateRowsEnabled="False">
<ig:XamGrid.Columns>
<ig:TextColumn Key="DeliveryQuantityQty" ></ig:TextColumn>
<ig:ColumnLayout Key="Deliveries">
<ig:ColumnLayout.AddNewRowSettings>
<ig:AddNewRowSettingsOverride AllowAddNewRow="Bottom"/>
</ig:ColumnLayout.AddNewRowSettings>
<ig:ColumnLayout.Columns>
<ig:TextColumn Key="Qty" ></ig:TextColumn>
</ig:ColumnLayout.Columns>
</ig:ColumnLayout>
</ig:XamGrid.Columns>
</ig:XamGrid>
Problem : When i add row in the Delivries in the ColumnLayout the parent column DeliveryQuantityQty is not update.
When i use sort function of XamGrid on column the DeliveryQuantityQty is update.
I would like to get the new value after adding Delivery.
Is there any way to avoid this problem ? (use summary function in header of columnlayout is a possibility ?)
Thanks a lot for your help.
Hello,
Thank you for the new sample you have provided.
The functionality you were aiming for in regards to updating the parent row based on it's children rows' values seems to be achieved. The wrapper classes look well implemented.
Any further manipulation in the application would strongly depend on the whole implementation of the behavior you are aiming for.
If you have any further questions, please let me know.
I created sample with wrapper class.
Could you say me if i could do better than this way ?
I had to create 2 wrapper classes.
Thanks for your help.
Thank you for the modified sample you have provided in your previous reply.
Since the Deliveries collection you are using is of EntityCollection type and does not implement the INotifyCollectionChanged interface (this is the interface that the ObservableCollection implements and thus contains the CollectionChanged event), an approach I can suggest you is to create an additional wrapper collection class, that uses the EntityCollection and implements the INotifyCollectionChanged interface according to the entity collection.
This way you will be able to analogically hook for the CollectionChanged event of the wrapper class and make the necessary checks/changes over your data.A similar issue has been discussed at the following topic: http://stackoverflow.com/questions/628437/best-practices-for-using-the-entity-framework-with-wpf-databinding
Hello Maria,
In my sample i already use an ObservableCollection<Order>.
Order.Items is return by EntityFramework.
It's the same for Item.Deliveries.
This is generated items by diagram.
Could you try to modify my sample because i don't really know how can i avoid this problem.
Thanks a lot.
Hello,Using the ObservableCollection instead of a List will set changed notifications when items are added and removed from the collection. Having the three level data could be handled using nested ObservableCollections and there is no need for separate viewmodel classes.Please let me know if you have any other questions.