Пример #1
0
        //
        // Methods
        //
        protected virtual void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e)
        {
            CleanUpVirtualizedItemEventHandler handler = CleanUpVirtualizedItemEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #2
0
        //
        // Helper Methods
        //
        void RemoveUnusedContainers(int first, int count)
        {
            IRecyclingItemContainerGenerator generator = ItemContainerGenerator as IRecyclingItemContainerGenerator;
            ItemsControl       owner = ItemsControl.GetItemsOwner(this);
            VirtualizationMode mode  = GetVirtualizationMode(this);
            CleanUpVirtualizedItemEventArgs args;
            int last = first + count - 1;
            GeneratorPosition pos;
            int item;

            //Console.WriteLine ("VSP.RemoveUnusedContainers ({0}, {1});", first, count);
            pos = new GeneratorPosition(Children.Count - 1, 0);
            while (pos.Index >= 0)
            {
                item = generator.IndexFromGeneratorPosition(pos);

                if (item < first || item > last)
                {
                    //Console.WriteLine ("\tRemoving item[{0}] (child #{1})", item, pos.Index);
                    args = new CleanUpVirtualizedItemEventArgs(Children[pos.Index], owner.Items[item]);
                    OnCleanUpVirtualizedItem(args);

                    if (!args.Cancel)
                    {
                        RemoveInternalChildRange(pos.Index, 1);

                        if (mode == VirtualizationMode.Recycling)
                        {
                            generator.Recycle(pos, 1);
                        }
                        else
                        {
                            generator.Remove(pos, 1);
                        }
                    }
                }

                pos.Index--;
            }
        }
Пример #3
0
        /// <summary>
        ///     Override method to suppress the cleanup of rows 
        ///     with validation errors.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e) 
        {
            base.OnCleanUpVirtualizedItem(e); 
 
            if (e.UIElement != null &&
                Validation.GetHasError(e.UIElement)) 
            {
                e.Cancel = true;
            }
        } 
Пример #4
0
		//
		// Methods
		//
		protected virtual void OnCleanUpVirtualizedItem (CleanUpVirtualizedItemEventArgs e)
		{
			CleanUpVirtualizedItemEventHandler handler = CleanUpVirtualizedItemEvent;
			
			if (handler != null)
				handler (this, e);
		}
Пример #5
0
		//
		// Helper Methods
		//
		void RemoveUnusedContainers (int first, int count)
		{
			IRecyclingItemContainerGenerator generator = ItemContainerGenerator as IRecyclingItemContainerGenerator;
			ItemsControl owner = ItemsControl.GetItemsOwner (this);
			VirtualizationMode mode = GetVirtualizationMode (this);
			CleanUpVirtualizedItemEventArgs args;
			int last = first + count - 1;
			GeneratorPosition pos;
			int item;
			
			//Console.WriteLine ("VSP.RemoveUnusedContainers ({0}, {1});", first, count);
			pos = new GeneratorPosition (Children.Count - 1, 0);
			while (pos.Index >= 0) {
				item = generator.IndexFromGeneratorPosition (pos);
				
				if (item < first || item > last) {
					//Console.WriteLine ("\tRemoving item[{0}] (child #{1})", item, pos.Index);
					args = new CleanUpVirtualizedItemEventArgs (Children[pos.Index], owner.Items[item]);
					OnCleanUpVirtualizedItem (args);
					
					if (!args.Cancel) {
						RemoveInternalChildRange (pos.Index, 1);
						
						if (mode == VirtualizationMode.Recycling)
							generator.Recycle (pos, 1);
						else
							generator.Remove (pos, 1);
					}
				}
				
				pos.Index--;
			}
		}
Пример #6
0
 protected virtual new void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e)
 {
   Contract.Requires(e != null);
 }
Пример #7
0
 private void LV_CleanUpVirtualizedItem(object sender, CleanUpVirtualizedItemEventArgs e)
 {
     StaticData.PreviewTasks.CancelTask(((DataItem)e.Value).Md5);
 }
Пример #8
0
 protected override void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e)
 {
     e.UIElement.ClearValue(OffsetProperty);
     base.OnCleanUpVirtualizedItem(e);
 }
Пример #9
0
        /// <summary> 
        ///     Called when an item is being re-virtualized. 
        /// </summary>
        protected virtual void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e) 
        {
            ItemsControl itemsControl = ItemsControl.GetItemsOwner(this);

            if (itemsControl != null) 
            {
                itemsControl.RaiseEvent(e); 
            } 
        }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// cleanupvirtualizeditemeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this CleanUpVirtualizedItemEventHandler cleanupvirtualizeditemeventhandler, Object sender, CleanUpVirtualizedItemEventArgs e, AsyncCallback callback)
        {
            if(cleanupvirtualizeditemeventhandler == null) throw new ArgumentNullException("cleanupvirtualizeditemeventhandler");

            return cleanupvirtualizeditemeventhandler.BeginInvoke(sender, e, callback, null);
        }
Пример #11
0
        private bool NotifyCleanupItem(UIElement child, ItemsControl itemsControl)
        { 
            CleanUpVirtualizedItemEventArgs e = new CleanUpVirtualizedItemEventArgs(itemsControl.ItemContainerGenerator.ItemFromContainer(child), child); 
            e.Source = this;
            OnCleanUpVirtualizedItem(e); 

            return !e.Cancel;
        }
Пример #12
0
		private void CleanUpVirtualizedItemHandler(object sender, CleanUpVirtualizedItemEventArgs args)
		{
			args.Cancel = DataGridHelper.CanBeRecycled(args.UIElement);
		}
Пример #13
0
 protected virtual new void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e)
 {
 }
Пример #14
0
 private static void CleanUpVirtualizedItem(object sender, CleanUpVirtualizedItemEventArgs e)
 {
     var me = (DynamicGridCellsPanel)sender;
 }
Пример #15
0
 private void CleanUpVirtualizedItemHandler(object sender, CleanUpVirtualizedItemEventArgs e)
 {
     if (updatedWindowLock == false)
     {
         int i = (e.UIElement as DataGridRow).GetIndex();
         updatedWindow.Remove(i);
     }
 }