Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / Controls / VirtualizingPanel.cs / 1 / VirtualizingPanel.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using MS.Internal; using MS.Utility; using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Windows.Media; using System.Windows.Controls.Primitives; // IItemContainerGenerator namespace System.Windows.Controls { ////// A base class that provides access to information that is useful for panels that with to implement virtualization. /// public abstract class VirtualizingPanel : Panel { ////// The default constructor. /// protected VirtualizingPanel() : base(true) { } ////// The generator associated with this panel. /// public IItemContainerGenerator ItemContainerGenerator { get { return Generator; } } ////// Adds a child to the InternalChildren collection. /// This method is meant to be used when a virtualizing panel /// generates a new child. This method circumvents some validation /// that occurs in UIElementCollection.Add. /// /// Child to add. protected void AddInternalChild(UIElement child) { AddInternalChild(InternalChildren, child); } ////// Inserts a child into the InternalChildren collection. /// This method is meant to be used when a virtualizing panel /// generates a new child. This method circumvents some validation /// that occurs in UIElementCollection.Insert. /// /// The index at which to insert the child. /// Child to insert. protected void InsertInternalChild(int index, UIElement child) { InsertInternalChild(InternalChildren, index, child); } ////// Removes a child from the InternalChildren collection. /// This method is meant to be used when a virtualizing panel /// re-virtualizes a new child. This method circumvents some validation /// that occurs in UIElementCollection.RemoveRange. /// /// /// protected void RemoveInternalChildRange(int index, int range) { RemoveInternalChildRange(InternalChildren, index, range); } // This is internal as an optimization for VirtualizingStackPanel (so it doesn't need to re-query InternalChildren repeatedly) internal static void AddInternalChild(UIElementCollection children, UIElement child) { children.AddInternal(child); } // This is internal as an optimization for VirtualizingStackPanel (so it doesn't need to re-query InternalChildren repeatedly) internal static void InsertInternalChild(UIElementCollection children, int index, UIElement child) { children.InsertInternal(index, child); } // This is internal as an optimization for VirtualizingStackPanel (so it doesn't need to re-query InternalChildren repeatedly) internal static void RemoveInternalChildRange(UIElementCollection children, int index, int range) { children.RemoveRangeInternal(index, range); } ////// Called when the Items collection associated with the containing ItemsControl changes. /// /// sender /// Event arguments protected virtual void OnItemsChanged(object sender, ItemsChangedEventArgs args) { } ////// Called when the UI collection of children is cleared by the base Panel class. /// protected virtual void OnClearChildren() { } ////// Generates the item at the specified index and calls BringIntoView on it. /// /// Specify the item index that should become visible protected internal virtual void BringIndexIntoView(int index) { } internal override void OnItemsChangedInternal(object sender, ItemsChangedEventArgs args) { switch (args.Action) { case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Replace: case NotifyCollectionChangedAction.Move: // Don't allow Panel's code to run for add/remove/replace/move break; default: base.OnItemsChangedInternal(sender, args); break; } OnItemsChanged(sender, args); } internal override void OnClearChildrenInternal() { OnClearChildren(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using MS.Internal; using MS.Utility; using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Windows.Media; using System.Windows.Controls.Primitives; // IItemContainerGenerator namespace System.Windows.Controls { ////// A base class that provides access to information that is useful for panels that with to implement virtualization. /// public abstract class VirtualizingPanel : Panel { ////// The default constructor. /// protected VirtualizingPanel() : base(true) { } ////// The generator associated with this panel. /// public IItemContainerGenerator ItemContainerGenerator { get { return Generator; } } ////// Adds a child to the InternalChildren collection. /// This method is meant to be used when a virtualizing panel /// generates a new child. This method circumvents some validation /// that occurs in UIElementCollection.Add. /// /// Child to add. protected void AddInternalChild(UIElement child) { AddInternalChild(InternalChildren, child); } ////// Inserts a child into the InternalChildren collection. /// This method is meant to be used when a virtualizing panel /// generates a new child. This method circumvents some validation /// that occurs in UIElementCollection.Insert. /// /// The index at which to insert the child. /// Child to insert. protected void InsertInternalChild(int index, UIElement child) { InsertInternalChild(InternalChildren, index, child); } ////// Removes a child from the InternalChildren collection. /// This method is meant to be used when a virtualizing panel /// re-virtualizes a new child. This method circumvents some validation /// that occurs in UIElementCollection.RemoveRange. /// /// /// protected void RemoveInternalChildRange(int index, int range) { RemoveInternalChildRange(InternalChildren, index, range); } // This is internal as an optimization for VirtualizingStackPanel (so it doesn't need to re-query InternalChildren repeatedly) internal static void AddInternalChild(UIElementCollection children, UIElement child) { children.AddInternal(child); } // This is internal as an optimization for VirtualizingStackPanel (so it doesn't need to re-query InternalChildren repeatedly) internal static void InsertInternalChild(UIElementCollection children, int index, UIElement child) { children.InsertInternal(index, child); } // This is internal as an optimization for VirtualizingStackPanel (so it doesn't need to re-query InternalChildren repeatedly) internal static void RemoveInternalChildRange(UIElementCollection children, int index, int range) { children.RemoveRangeInternal(index, range); } ////// Called when the Items collection associated with the containing ItemsControl changes. /// /// sender /// Event arguments protected virtual void OnItemsChanged(object sender, ItemsChangedEventArgs args) { } ////// Called when the UI collection of children is cleared by the base Panel class. /// protected virtual void OnClearChildren() { } ////// Generates the item at the specified index and calls BringIntoView on it. /// /// Specify the item index that should become visible protected internal virtual void BringIndexIntoView(int index) { } internal override void OnItemsChangedInternal(object sender, ItemsChangedEventArgs args) { switch (args.Action) { case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Replace: case NotifyCollectionChangedAction.Move: // Don't allow Panel's code to run for add/remove/replace/move break; default: base.OnItemsChangedInternal(sender, args); break; } OnItemsChanged(sender, args); } internal override void OnClearChildrenInternal() { OnClearChildren(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- COSERVERINFO.cs
- WindowsRichEditRange.cs
- ObjectStateFormatter.cs
- BatchWriter.cs
- ControlIdConverter.cs
- DPCustomTypeDescriptor.cs
- SamlAttribute.cs
- HtmlTableRow.cs
- Activity.cs
- TextSpanModifier.cs
- IOThreadScheduler.cs
- X509ClientCertificateAuthenticationElement.cs
- SecurityTokenAuthenticator.cs
- UnsafeNativeMethods.cs
- ClientTargetCollection.cs
- TextEditorContextMenu.cs
- EntryWrittenEventArgs.cs
- IEnumerable.cs
- ListItemCollection.cs
- TemplateManager.cs
- _ConnectStream.cs
- WebServiceErrorEvent.cs
- NameValuePermission.cs
- validation.cs
- PrivilegedConfigurationManager.cs
- DynamicActivityTypeDescriptor.cs
- AdPostCacheSubstitution.cs
- SyndicationSerializer.cs
- Keyboard.cs
- WebPartCloseVerb.cs
- Hashtable.cs
- ListComponentEditor.cs
- ProxyHwnd.cs
- ExitEventArgs.cs
- HtmlInputHidden.cs
- ObjRef.cs
- ContentPosition.cs
- MessageLoggingFilterTraceRecord.cs
- MimeMultiPart.cs
- ComponentChangingEvent.cs
- ReverseInheritProperty.cs
- SqlSupersetValidator.cs
- TablePattern.cs
- ErrorsHelper.cs
- HtmlInputImage.cs
- COMException.cs
- ProfilePropertyMetadata.cs
- DurableInstanceProvider.cs
- ByteAnimation.cs
- XmlLoader.cs
- StaticFileHandler.cs
- ServicesExceptionNotHandledEventArgs.cs
- DesigntimeLicenseContext.cs
- Page.cs
- DataServiceRequestException.cs
- Converter.cs
- PingReply.cs
- DynamicExpression.cs
- GlyphRunDrawing.cs
- ResourceLoader.cs
- WebSysDescriptionAttribute.cs
- Delegate.cs
- GenericTextProperties.cs
- EntityDesignerUtils.cs
- PackagingUtilities.cs
- WizardStepBase.cs
- ArgumentValidation.cs
- CustomPopupPlacement.cs
- EdmConstants.cs
- LessThan.cs
- RuntimeEnvironment.cs
- _LocalDataStoreMgr.cs
- ContentType.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- DynamicDataRouteHandler.cs
- EventMappingSettingsCollection.cs
- RuntimeWrappedException.cs
- Menu.cs
- ColumnResizeAdorner.cs
- ImageListUtils.cs
- PropertyEmitterBase.cs
- OdbcReferenceCollection.cs
- BoundingRectTracker.cs
- FixedPosition.cs
- TableAutomationPeer.cs
- UriTemplate.cs
- OracleDateTime.cs
- XmlBoundElement.cs
- ControlOperationBehavior.cs
- AQNBuilder.cs
- ListViewUpdateEventArgs.cs
- SchemaMapping.cs
- DragStartedEventArgs.cs
- DbExpressionBuilder.cs
- TraceProvider.cs
- _OverlappedAsyncResult.cs
- EnumerableRowCollectionExtensions.cs
- VideoDrawing.cs
- RSAPKCS1KeyExchangeFormatter.cs
- Gdiplus.cs