Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Controls / SelectedCellsCollection.cs / 1305600 / SelectedCellsCollection.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; namespace System.Windows.Controls { ////// A collection that optimizes the storage of DataGridCellInfo. /// ////// The collection is exposed through the DataGrid.SelectedCells property as /// a generic IList. /// /// The collection maintains a list of DataGridCellInfo so that users of the /// SelectedCells property can interact with it like a normal list. /// /// The collection maintains a dictionary mapping rows to columns and /// a dictionary that maps columns to rows. This allows quick retrieval /// of all selected cells in a particular row or column. These are /// operations that occur when select/deselecting a row or column. /// /// The collection implements all the parts of INotifyCollectionChanged so /// that the DataGrid can be notified of changes, but does not expose the /// interface so that SelectedCells can't be cast to it. This was to /// reduce the test coverage and the undiscoverability of the interface. /// internal sealed class SelectedCellsCollection : VirtualizedCellInfoCollection { #region Construction internal SelectedCellsCollection(DataGrid owner) : base(owner) { } #endregion #region DataGrid API ////// Calculates the bounding box of the cells. /// ///true if not empty, false if empty. internal bool GetSelectionRange(out int minColumnDisplayIndex, out int maxColumnDisplayIndex, out int minRowIndex, out int maxRowIndex) { if (IsEmpty) { minColumnDisplayIndex = -1; maxColumnDisplayIndex = -1; minRowIndex = -1; maxRowIndex = -1; return false; } else { GetBoundingRegion(out minColumnDisplayIndex, out minRowIndex, out maxColumnDisplayIndex, out maxRowIndex); return true; } } #endregion #region Collection Changed Notification ////// Notify the owning DataGrid of changes to this collection. /// protected override void OnCollectionChanged(NotifyCollectionChangedAction action, VirtualizedCellInfoCollection oldItems, VirtualizedCellInfoCollection newItems) { Owner.OnSelectedCellsChanged(action, oldItems, newItems); } #endregion } } // 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 System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; namespace System.Windows.Controls { ////// A collection that optimizes the storage of DataGridCellInfo. /// ////// The collection is exposed through the DataGrid.SelectedCells property as /// a generic IList. /// /// The collection maintains a list of DataGridCellInfo so that users of the /// SelectedCells property can interact with it like a normal list. /// /// The collection maintains a dictionary mapping rows to columns and /// a dictionary that maps columns to rows. This allows quick retrieval /// of all selected cells in a particular row or column. These are /// operations that occur when select/deselecting a row or column. /// /// The collection implements all the parts of INotifyCollectionChanged so /// that the DataGrid can be notified of changes, but does not expose the /// interface so that SelectedCells can't be cast to it. This was to /// reduce the test coverage and the undiscoverability of the interface. /// internal sealed class SelectedCellsCollection : VirtualizedCellInfoCollection { #region Construction internal SelectedCellsCollection(DataGrid owner) : base(owner) { } #endregion #region DataGrid API ////// Calculates the bounding box of the cells. /// ///true if not empty, false if empty. internal bool GetSelectionRange(out int minColumnDisplayIndex, out int maxColumnDisplayIndex, out int minRowIndex, out int maxRowIndex) { if (IsEmpty) { minColumnDisplayIndex = -1; maxColumnDisplayIndex = -1; minRowIndex = -1; maxRowIndex = -1; return false; } else { GetBoundingRegion(out minColumnDisplayIndex, out minRowIndex, out maxColumnDisplayIndex, out maxRowIndex); return true; } } #endregion #region Collection Changed Notification ////// Notify the owning DataGrid of changes to this collection. /// protected override void OnCollectionChanged(NotifyCollectionChangedAction action, VirtualizedCellInfoCollection oldItems, VirtualizedCellInfoCollection newItems) { Owner.OnSelectedCellsChanged(action, oldItems, newItems); } #endregion } } // 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
- cookieexception.cs
- FamilyCollection.cs
- PrefixQName.cs
- Publisher.cs
- WebServiceMethodData.cs
- VScrollProperties.cs
- Point3DAnimationBase.cs
- SingleAnimationBase.cs
- Color.cs
- ColorTranslator.cs
- Win32Native.cs
- ApplicationSecurityManager.cs
- XmlUrlResolver.cs
- OutputScopeManager.cs
- MemoryMappedViewStream.cs
- ListDictionaryInternal.cs
- CodeGotoStatement.cs
- DateTimeOffsetConverter.cs
- TheQuery.cs
- DeriveBytes.cs
- NavigatingCancelEventArgs.cs
- FormsAuthenticationUserCollection.cs
- TTSEvent.cs
- EdgeProfileValidation.cs
- SqlAliaser.cs
- RotateTransform.cs
- CatalogZone.cs
- PrinterResolution.cs
- DbTransaction.cs
- HttpHostedTransportConfiguration.cs
- HtmlTextArea.cs
- ComponentCollection.cs
- DocumentDesigner.cs
- DATA_BLOB.cs
- SolidBrush.cs
- Bidi.cs
- FixedBufferAttribute.cs
- QueryableDataSource.cs
- NetCodeGroup.cs
- XPathBinder.cs
- ManagedFilter.cs
- RangeValuePattern.cs
- NumericUpDownAcceleration.cs
- RequestCacheManager.cs
- SettingsPropertyValue.cs
- LinqDataSourceValidationException.cs
- CodeTypeMember.cs
- SmiRequestExecutor.cs
- DataListAutoFormat.cs
- RuntimeConfig.cs
- FeatureSupport.cs
- OrthographicCamera.cs
- TextBoxAutomationPeer.cs
- HtmlInputHidden.cs
- NullableDoubleAverageAggregationOperator.cs
- HttpPostProtocolImporter.cs
- ContextStack.cs
- MailWriter.cs
- DataGridCell.cs
- CultureInfoConverter.cs
- Boolean.cs
- PermissionSetTriple.cs
- CultureTable.cs
- ApplicationGesture.cs
- MessageDroppedTraceRecord.cs
- GenericUriParser.cs
- BulletedListEventArgs.cs
- ObjectQuery_EntitySqlExtensions.cs
- TextElementCollectionHelper.cs
- XmlILIndex.cs
- WsiProfilesElementCollection.cs
- ToolStripPanelRow.cs
- PropertyMap.cs
- PreservationFileReader.cs
- FunctionUpdateCommand.cs
- RoleGroupCollection.cs
- HttpModule.cs
- UserNamePasswordValidator.cs
- RectAnimationUsingKeyFrames.cs
- CheckBox.cs
- SqlBooleanMismatchVisitor.cs
- TextView.cs
- TouchFrameEventArgs.cs
- TextCompositionEventArgs.cs
- FormsAuthenticationEventArgs.cs
- IDispatchConstantAttribute.cs
- InlinedLocationReference.cs
- Vars.cs
- BitmapScalingModeValidation.cs
- InputScopeConverter.cs
- CollectionBase.cs
- VirtualPathUtility.cs
- WSHttpSecurityElement.cs
- ProjectionPlan.cs
- BinaryFormatter.cs
- SaveFileDialogDesigner.cs
- _emptywebproxy.cs
- ISAPIWorkerRequest.cs
- ServerIdentity.cs
- XmlTypeMapping.cs