Refracted Paladin
Refracted Paladin

Reputation: 12216

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.

Upvotes: 3

Views: 3681

Answers (5)

Curt Toppin
Curt Toppin

Reputation: 29

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

Upvotes: 1

AlexThunder
AlexThunder

Reputation: 168

Call when need to update:

bindingList.ResetBindings();

Upvotes: 3

Joorge Leal
Joorge Leal

Reputation: 560

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)

Upvotes: 2

Pedro Angel
Pedro Angel

Reputation: 116

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.

Upvotes: 2

Alan
Alan

Reputation: 7951

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()

Upvotes: 1

Related Questions