I have a problem.
I have this WPF GridView
<DataGrid ItemsSource="{Binding Path=myOrder.Detail}"></DataGrid>
My property on the viewModel looks like this:
public myOrderModel myOrder { get; set; }
and this is my model:
public partial class myOrderModel{ public int ID_Order { get; set; } public List<myOrdenDetail> Detail { get; set; }}
On the constructor of the viewmodel y fill my Order with data from a WCF service and the detail is show on the grid correctly (of course this code is simplified). Now I need to modify de Detail collection (add, remove or modify) from inside the viewmodel. The problem is that the gridview is not refreshed to show this changes.
How can i notify the grid to reflect the changes inside Detail List?Thanks!!!!
EDIT
As suggested i try with ObservableCollection and it worked. In the viewModel I add a property:
public ObservableCollection<myOrdenDetail> Detail{ get; set; }
and Map the model to my new property:
Detail = new ObservableCollection<myOrdenDetail>(myOrder.Detail);
Of course i need to map Detail back to the original model when I save the information. I could also change the original model behind WCF service but i don't know how would WCF react with ObservableCollection.
Thanks!