Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / Controls / Primitives / MultiSelector.cs / 1 / MultiSelector.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Collections; using System.Collections.ObjectModel; namespace System.Windows.Controls.Primitives { ////// Extends the Selector class by adding a multi selection support. /// public abstract class MultiSelector : Selector { ////// Returns whether or not multiple items can be selected /// protected bool CanSelectMultipleItems { get { return base.CanSelectMultiple; } set { base.CanSelectMultiple = value; } } ////// Returns the collection of currently Selected Items. /// Note, this is not the set of items that are pending selection. /// Exceptions: /// While IsUpdatingSelectedItems, using the indexer, Insert, and RemoveAt will throw InvalidOperationExceptions. /// If CanSelectMultiple is false then Adding one item to SelectedItems is valid but adding items after that is invalid and will result in an InvalidOperationException. /// [Bindable(true), Category("Appearance"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public IList SelectedItems { get { return SelectedItemsImpl; } } #region BulkSelection ////// Starts a new selection transaction, setting IsUpdatingSelectedItems to true. /// Exceptions: InvalidOperationException if IsUpdatingSelectedItems is true. /// protected void BeginUpdateSelectedItems() { ((SelectedItemCollection)SelectedItems).BeginUpdateSelectedItems(); } ////// Commits a selection transaction, populating or removing items from the SelectedItems collection and resets IsUpdatingSelectedItems to false. /// Exceptions: InvalidOperationException if IsUpdatingSelectedItems is false /// protected void EndUpdateSelectedItems() { ((SelectedItemCollection)SelectedItems).EndUpdateSelectedItems(); } ////// Returns true if SelectedItems is being updated using the deferred update behavior. /// Otherwise, it is false and updating SelectedItems is immediate. /// Calling BeginUpdateSelectedItems will set this value to become true. /// Calling EndUpdateSelectedItems will cause the deferred selections to be submitted and this value to become false. /// protected bool IsUpdatingSelectedItems { get { return ((SelectedItemCollection)SelectedItems).IsUpdatingSelectedItems; } } ////// Select all the items /// Exceptions: InvalidOperationExcpetion if CanSelectMultipleItems is false /// public void SelectAll() { if (CanSelectMultipleItems) { SelectAllImpl(); } else { throw new NotSupportedException(SR.Get(SRID.MultiSelectorSelectAll)); } } ////// Clears all of the selected items. /// public void UnselectAll() { UnselectAllImpl(); } #endregion BulkSelection } } // 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.ComponentModel; using System.Collections; using System.Collections.ObjectModel; namespace System.Windows.Controls.Primitives { ////// Extends the Selector class by adding a multi selection support. /// public abstract class MultiSelector : Selector { ////// Returns whether or not multiple items can be selected /// protected bool CanSelectMultipleItems { get { return base.CanSelectMultiple; } set { base.CanSelectMultiple = value; } } ////// Returns the collection of currently Selected Items. /// Note, this is not the set of items that are pending selection. /// Exceptions: /// While IsUpdatingSelectedItems, using the indexer, Insert, and RemoveAt will throw InvalidOperationExceptions. /// If CanSelectMultiple is false then Adding one item to SelectedItems is valid but adding items after that is invalid and will result in an InvalidOperationException. /// [Bindable(true), Category("Appearance"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public IList SelectedItems { get { return SelectedItemsImpl; } } #region BulkSelection ////// Starts a new selection transaction, setting IsUpdatingSelectedItems to true. /// Exceptions: InvalidOperationException if IsUpdatingSelectedItems is true. /// protected void BeginUpdateSelectedItems() { ((SelectedItemCollection)SelectedItems).BeginUpdateSelectedItems(); } ////// Commits a selection transaction, populating or removing items from the SelectedItems collection and resets IsUpdatingSelectedItems to false. /// Exceptions: InvalidOperationException if IsUpdatingSelectedItems is false /// protected void EndUpdateSelectedItems() { ((SelectedItemCollection)SelectedItems).EndUpdateSelectedItems(); } ////// Returns true if SelectedItems is being updated using the deferred update behavior. /// Otherwise, it is false and updating SelectedItems is immediate. /// Calling BeginUpdateSelectedItems will set this value to become true. /// Calling EndUpdateSelectedItems will cause the deferred selections to be submitted and this value to become false. /// protected bool IsUpdatingSelectedItems { get { return ((SelectedItemCollection)SelectedItems).IsUpdatingSelectedItems; } } ////// Select all the items /// Exceptions: InvalidOperationExcpetion if CanSelectMultipleItems is false /// public void SelectAll() { if (CanSelectMultipleItems) { SelectAllImpl(); } else { throw new NotSupportedException(SR.Get(SRID.MultiSelectorSelectAll)); } } ////// Clears all of the selected items. /// public void UnselectAll() { UnselectAllImpl(); } #endregion BulkSelection } } // 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
- AccessibleObject.cs
- SafeHandle.cs
- WebPartVerbCollection.cs
- IdentityNotMappedException.cs
- CTreeGenerator.cs
- DetailsViewCommandEventArgs.cs
- OutputCacheSettingsSection.cs
- NamespaceExpr.cs
- View.cs
- KeyGestureValueSerializer.cs
- ToolboxDataAttribute.cs
- SessionSymmetricTransportSecurityProtocolFactory.cs
- XPathNodeInfoAtom.cs
- SmtpNegotiateAuthenticationModule.cs
- UserControl.cs
- UpDownBase.cs
- SqlCharStream.cs
- AuthorizationRuleCollection.cs
- DataTransferEventArgs.cs
- DataColumnMapping.cs
- PointUtil.cs
- thaishape.cs
- QuaternionAnimationUsingKeyFrames.cs
- XmlArrayItemAttribute.cs
- IssuanceLicense.cs
- CodeBlockBuilder.cs
- TrackingProfileSerializer.cs
- CircleHotSpot.cs
- BasicExpandProvider.cs
- FormViewModeEventArgs.cs
- SecurityState.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- XmlSchemaImporter.cs
- StylusTip.cs
- WorkflowDesignerMessageFilter.cs
- EastAsianLunisolarCalendar.cs
- Point3DConverter.cs
- LayoutEditorPart.cs
- XmlStringTable.cs
- recordstate.cs
- EditorPart.cs
- EdmComplexPropertyAttribute.cs
- ManagementPath.cs
- PageVisual.cs
- Encoder.cs
- ContentFilePart.cs
- Image.cs
- ExpressionVisitor.cs
- DataControlFieldCell.cs
- Attributes.cs
- typedescriptorpermission.cs
- KeyProperty.cs
- SemanticKeyElement.cs
- GeometryConverter.cs
- AppDomainManager.cs
- PageThemeCodeDomTreeGenerator.cs
- TextTreeInsertElementUndoUnit.cs
- OleDbCommand.cs
- AssemblyBuilder.cs
- CalendarDateRangeChangingEventArgs.cs
- TriState.cs
- SafeHandles.cs
- IndentTextWriter.cs
- HttpModulesSection.cs
- TdsParameterSetter.cs
- ConcurrentDictionary.cs
- Task.cs
- XmlUtf8RawTextWriter.cs
- GifBitmapEncoder.cs
- Evaluator.cs
- SatelliteContractVersionAttribute.cs
- OrCondition.cs
- LayoutEditorPart.cs
- CollectionBuilder.cs
- InitializationEventAttribute.cs
- InvokeSchedule.cs
- PackUriHelper.cs
- RelatedPropertyManager.cs
- DifferencingCollection.cs
- QualificationDataItem.cs
- SmtpException.cs
- MediaCommands.cs
- TextTrailingCharacterEllipsis.cs
- NotFiniteNumberException.cs
- CustomAssemblyResolver.cs
- WMIGenerator.cs
- InvalidCastException.cs
- ContextStack.cs
- NetworkInformationException.cs
- DbMetaDataFactory.cs
- TextDecorationCollection.cs
- AbandonedMutexException.cs
- RangeValueProviderWrapper.cs
- HtmlInputCheckBox.cs
- TransactionScope.cs
- SQLMoneyStorage.cs
- ManualWorkflowSchedulerService.cs
- PeerNearMe.cs
- DbConnectionPoolOptions.cs
- PeerOutputChannel.cs