// // Methods // protected virtual void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e) { CleanUpVirtualizedItemEventHandler handler = CleanUpVirtualizedItemEvent; if (handler != null) { handler(this, e); } }
// // 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--; } }
/// <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; } }
// // Methods // protected virtual void OnCleanUpVirtualizedItem (CleanUpVirtualizedItemEventArgs e) { CleanUpVirtualizedItemEventHandler handler = CleanUpVirtualizedItemEvent; if (handler != null) handler (this, e); }
// // 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--; } }
protected virtual new void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e) { Contract.Requires(e != null); }
private void LV_CleanUpVirtualizedItem(object sender, CleanUpVirtualizedItemEventArgs e) { StaticData.PreviewTasks.CancelTask(((DataItem)e.Value).Md5); }
protected override void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e) { e.UIElement.ClearValue(OffsetProperty); base.OnCleanUpVirtualizedItem(e); }
/// <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); }
private bool NotifyCleanupItem(UIElement child, ItemsControl itemsControl) { CleanUpVirtualizedItemEventArgs e = new CleanUpVirtualizedItemEventArgs(itemsControl.ItemContainerGenerator.ItemFromContainer(child), child); e.Source = this; OnCleanUpVirtualizedItem(e); return !e.Cancel; }
private void CleanUpVirtualizedItemHandler(object sender, CleanUpVirtualizedItemEventArgs args) { args.Cancel = DataGridHelper.CanBeRecycled(args.UIElement); }
protected virtual new void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e) { }
private static void CleanUpVirtualizedItem(object sender, CleanUpVirtualizedItemEventArgs e) { var me = (DynamicGridCellsPanel)sender; }
private void CleanUpVirtualizedItemHandler(object sender, CleanUpVirtualizedItemEventArgs e) { if (updatedWindowLock == false) { int i = (e.UIElement as DataGridRow).GetIndex(); updatedWindow.Remove(i); } }