Wpf listbox observablecollection not updating
Rad Grid View fully supports binding to a regular Observable Collection-based collections and should be fully WCF-compliant., with the selection mode set to extended (so we can select multiple items using ctrl/shift click or the keyboard equivalents).
Rather than use Dispatcher as suggested, I used a Task Factory code as follows.
Task Factory ui Factory;......public Main Window View Model(IDialog Service dialog Service)....._vehicle Weight Manager_Property Changed(object sender, Property Changed Event Args e)Further reading for the above method can be found here c# wpf user-interface mvvm observablecollection edited May 23 at Community ♦ 1 1 asked Mar 4 '14 at Daniel Lane 1,117 11 26 1 Just an advice: remove the collection changed handler its unecessary.
Whenever I add an item to this collection, it /does/ fire an event to notify that the collection has changed, yet this isn't reflected on the GUI during run-time unless I attempt to manually resize the window as the program is running, almost as if a resizing the window forces the GUI to refresh.
The XAML for the relevant control is as follows _log Window; In the View Model constructor I initialize _log Window and wire up Log Window Collection Changed event to a handler which in turn fires a Property Changed notification. Add happens, my event listener fires and my breakpoint is hit to confirm the code gets that far as illustrated below After this my code calls the On Property Changed function which is inherited from my View Model Base, this functions fine for my other GUI elements such as labels and the like, so that almost certainly isn't the issue.
The data is present in the bound property, and afaik the GUI is alerted when a new item is added to the property... Thanks to the advice of tencntraze and kallocain this has been solved.
The problem was caused by another thread attempting to add to the Log Window collection which was causing erroneous behaviour.There is a good workaround though -- getting the default collection view yourself and passing it as an Items Source value for the Rad Grid View control.In other words, your code should look something like: ICollection View view = Collection View Source. Get Default View(_available On Board Sales Products); if (view. Add(New Person Name("Jules", "Verne")) End Sub End Class Public Class Person Name ' Methods Public Sub New(By Val first As String, By Val last As String) Me._first Name = first Me._last Name = last End Sub ' Properties Public Property First Name() As String Get Return Me._first Name End Get Set(By Val value As String) Me._first Name = value End Set End Property Public Property Last Name() As String Get Return Me._last Name End Get Set(By Val value As String) Me._last Name = value End Set End Property ' Fields Private _first Name As String Private _last Name As String End Class You can make the collection available for binding the same way you would with other common language runtime (CLR) objects, as described in Make Data Available for Binding in XAML.For more information, see the Binding to Collections section in the Data Binding Overview.Get Default View(_available On Board Sales Products); grid Food. Filter == null) else Do you think that would be OK as a requirement to your client code?