Okay, I am my wits end. The problem is that I am changing a value to a bound field in my datasource through code and it is not show up on the page -- here's the details:
1. Installed a hotfix 2075 which I prayed would fix this issue
2. Setting the datasource to the observable collection (initialization...):
if (grdPartsUsed.DataSource == null) {AppPropertiesHelper.SetProperty("UsedParts", _userParts);grdPartsUsed.DataSource = AppPropertiesHelper.GetProperty<ObservableCollection<UsedPart>>("UsedParts");}
3. Changing the collection item on another form:
UsedPart part = (from u in AppPropertiesHelper.GetProperty<ObservableCollection<UsedPart>>("UsedParts")where (u.PartID == _part.PartID)select u).Single<UsedPart>();part.Description = "This worked.";
4. After the change, the event that launches the form, I have a debug statement and in the view window I find that: My Datasource for the xamDataGrid shows the correct value, HOWEVER, the UI does not update with the correct value.
5. Convinced I had spelled the bound field incorrectly or done something wrong I tested the field (name of Description) -- if I update the field directly through the UI (the xamDataGrid) the datasource changes correctly.
<igDataGrid:Field Name="Description" Label="Description"><igDataGrid:Field.Settings><igDataGrid:FieldSettings LabelWidth="300" CellWidth="300" AllowEdit="True"></igDataGrid:FieldSettings></igDataGrid:Field.Settings></igDataGrid:Field>
6. There are always zero DataItems in the grid, no matter what happens (see above).
It seems to me to be straightforward, but for some reason the UI doesn't change with changes to the collection (adding items to the collection DO show though). Can someone PLEASE help on this because I have been troubleshooting this for several days convinced that it was something I was doing wrong and at this time I am not so sure.
Travis
Hello,
First.make sure that you have implemented the INotifyPropertyChanged interface to your underlying business class, as the collection would not know when to update. Then try using BindingList<T> instead of ObservableCollection<T>.
Regarding the DataItems, they will always be null if you set DataSource. DataItems collection is like the Items collection of an Items Control. You can set both Items(DataItems) or ItemsSource(DataSource).
Hope this helps.
I notice that when I change another cell, that the value will show up.
Is there a method call to force the values to refresh, like ye old databind() method?
I wonder if for some reason my hotfix didn't install correctly...