BrightIdeasSoftware.ObjectListView.SetObjects C# (CSharp) Method

SetObjects() public method

Set the collection of objects that will be shown in this list view.
The list is updated immediately
public SetObjects ( IEnumerable collection, bool preserveState ) : void
collection IEnumerable The objects to be displayed
preserveState bool Should the state of the list be preserved as far as is possible.
return void
        public virtual void SetObjects(IEnumerable collection, bool preserveState)
        {
            if (this.InvokeRequired) {
                this.Invoke((MethodInvoker)delegate { this.SetObjects(collection, preserveState); });
                return;
            }

            // Give the world a chance to cancel or change the assigned collection
            ItemsChangingEventArgs args = new ItemsChangingEventArgs(this.objects, collection);
            this.OnItemsChanging(args);
            if (args.Canceled)
                return;
            collection = args.NewObjects;

            // If we own the current list and they change to another list, we don't own it anymore
            if (this.isOwnerOfObjects && this.objects != collection)
                this.isOwnerOfObjects = false;
            this.objects = collection;
            this.BuildList(preserveState);

            // Tell the world that the list has changed
            this.UpdateNotificationSubscriptions(this.objects);
            this.OnItemsChanged(new ItemsChangedEventArgs());
        }

Same methods

ObjectListView::SetObjects ( IEnumerable collection ) : void

Usage Example

Beispiel #1
0
 private void StringListPutHelper(ObjectListView list_view, List<string> l, object row_object, object value)
 {
   for (int i = 0, count = l.Count; i < count; ++i)
   {
     if (Object.ReferenceEquals(row_object, l[i]))
     {
       l[i] = (string)value;
       break;
     }
   }
   list_view.SetObjects(l, true);
 }
All Usage Examples Of BrightIdeasSoftware.ObjectListView::SetObjects
ObjectListView