c# - Event when list has changed -
I have an event, when items change in my list and when this event is removed, then I I call a method for this list, when there are 5 new items in the list, my method is called 5 times, but already the new element is used but I only have to handle the last event. How can I solve it?
MyObject.ListItemsChanged + = RefreshElementsInUI; Then in method:
Private zero refreshElementsInUI (Object Sender, EventArgs E) {var listItems = getElementsForCommunication (Communications); ClearElementsInUi (); Forrestavage (various elements in the list) IdealementTomicol (element); } List transmitted incidents are removed 5 times if I have 5 new items in my communication but I only need the previous event because I do the same thing about 5 times
Hope this will help you
It appears that You have implemented IBINLLIL or are using the binding list. I recommend that I leave and define it. Batch mode is not built in any event driven NET archive (binding list, obscure collection), but it is not hard to implement from the Observable collection to implement your collection, and after that a batch method is writing AddRange ().
Public Class Megaliths & lt; T & gt; : Observable collection & lt; T & gt; {// New example of beginners Girisoft Common Magellak & lt; T & gt; Public megaliths (IEnumerable & lt; T & gt; collections) with elements from the collection: Base (archive) {} /// connects the elements of the collection specified in the batch mode, the public megallist and the lieutenant; T & gt; AddRange (IEnumerable & lt; T & gt; Collection) {foreach (item in the collection) Add (i); OnCollectionChanged (New NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction.Reset)); This return; }}
Comments
Post a Comment