简体   繁体   中英

UI not updating when BindingList<> changes

I'm doubting I get a response on SO for this but I'm at my wit's end so here's hoping.

I have a BindingList<myObj> and a BindingSource on my form with it's DataSource set to the BindingList. I then have a Resco Mobile Controls UIListView displaying this data.

On startup it displays just fine, data is bound properly and all but when I update any data it is never shown in the UI. I have INotifyPropertyChanged implemented on myObj and have no idea what else I should be looking for....

This is all on Windows CE 6 with .NET CF 3.5. Any ideas would be appreciated as I have been looking at this for a while now.

Usually what happens with the BindingList implementations is that only notify changes from add and delete actions, do not get notified on update of an item. I should recommend the use of ObservableCollection that notify the item changes. a similar post here. Binding List and UI controls, not updating on edit Regards, Pedro Morales.

I solved it modifying the collection from the main thread, if I change it from a secondary thread the changes are not updated in the grid. (Even calling currencyManager Refresh or DataGrid Refresh)

需要更新时调用:

bindingList.ResetBindings();

I'm going to take stab at this since you may not be getting a ton of traffic.

Have you tried getting the CurrencyManager and calling its refresh method? See the following:

CurrencyManager.Refresh()

Combining a few of the answers here got me to my solution. If you're not on the UI thread, you need to use an Invoke to call your refresh on UI thread instead.

Public Sub RefreshMyBoundList()
    If (Me.InvokeRequired) Then
        Me.Invoke(New Action(AddressOf RefreshMyBoundList))
        Return
    End If
    MyBoundList.ResetBindings()
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM