/// <summary>
        /// Set the collection of objects that this control will show.
        /// </summary>
        /// <param name="collection"></param>
        /// <remark>This method can safely be called from background threads.</remark>
        public override void SetObjects(IEnumerable collection)
        {
            if (this.InvokeRequired)
            {
                this.Invoke((MethodInvoker) delegate { this.SetObjects(collection); });
                return;
            }

            if (this.DataSource == null)
            {
                return;
            }

            this.BeginUpdate();
            try {
                // Give the world a chance to cancel or change the assigned collection
                ItemsChangingEventArgs args = new ItemsChangingEventArgs(null, collection);
                this.OnItemsChanging(args);
                if (args.Canceled)
                {
                    return;
                }

                this.DataSource.SetObjects(args.NewObjects);
                this.UpdateVirtualListSize();
                this.Sort();
            }
            finally {
                this.EndUpdate();
            }
        }
コード例 #2
0
 private void filterTree_ItemsChanging(object sender, ItemsChangingEventArgs e)
 {
     this.cboSavedSearches.SelectedIndex = -1;
 }
コード例 #3
0
		/// <summary>
		/// Set the collection of objects that this control will show.
		/// </summary>
		/// <param name="collection"></param>
		/// <remark>This method can safely be called from background threads.</remark>
		public override void SetObjects(IEnumerable collection) {
			if (this.InvokeRequired) {
				this.Invoke((MethodInvoker)delegate { this.SetObjects(collection); });
				return;
			}

			if (this.DataSource == null)
				return;

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

				this.DataSource.SetObjects(args.NewObjects);
				this.UpdateVirtualListSize();
				this.Sort();
			} finally {
				this.EndUpdate();
			}
		}