Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Controls / Primitives / MultiSelector.cs / 1305600 / 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
- DPTypeDescriptorContext.cs
- GradientSpreadMethodValidation.cs
- HttpRuntimeSection.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- OrderByQueryOptionExpression.cs
- RemoteWebConfigurationHostStream.cs
- DataBoundControl.cs
- CircleHotSpot.cs
- Normalization.cs
- StylusPlugin.cs
- objectresult_tresulttype.cs
- _NestedMultipleAsyncResult.cs
- MenuEventArgs.cs
- ClientConfigurationHost.cs
- PrimitiveCodeDomSerializer.cs
- XmlAttributeCache.cs
- _Events.cs
- XhtmlBasicLabelAdapter.cs
- XmlSchemaAnnotation.cs
- Win32SafeHandles.cs
- AsyncMethodInvoker.cs
- HMACSHA1.cs
- ReturnEventArgs.cs
- DrawingAttributeSerializer.cs
- HttpSessionStateWrapper.cs
- PerspectiveCamera.cs
- CodeTypeReferenceExpression.cs
- XpsImage.cs
- ProviderConnectionPointCollection.cs
- Control.cs
- ObjectSelectorEditor.cs
- ReadOnlyDataSource.cs
- HttpException.cs
- ParameterToken.cs
- XmlAttributeOverrides.cs
- TreeWalkHelper.cs
- RowSpanVector.cs
- NamedElement.cs
- MenuItemBinding.cs
- ToolStripComboBox.cs
- MatrixValueSerializer.cs
- SqlNamer.cs
- SecondaryIndex.cs
- TrackingProfileDeserializationException.cs
- HuffModule.cs
- OdbcConnectionOpen.cs
- CodeAttributeArgument.cs
- TextModifier.cs
- FlowNode.cs
- Hex.cs
- XmlReflectionMember.cs
- X509PeerCertificateAuthentication.cs
- BamlStream.cs
- PackageStore.cs
- HtmlTableCellCollection.cs
- ContainerFilterService.cs
- HyperLink.cs
- TypefaceCollection.cs
- Fonts.cs
- DataBoundControl.cs
- path.cs
- SchemaTableOptionalColumn.cs
- ManipulationDevice.cs
- GcHandle.cs
- FixedSOMTextRun.cs
- ResourceProperty.cs
- ConstructorArgumentAttribute.cs
- ProbeMatchesCD1.cs
- ApplicationDirectoryMembershipCondition.cs
- TcpAppDomainProtocolHandler.cs
- DataGridViewCellMouseEventArgs.cs
- XslVisitor.cs
- TaskFormBase.cs
- PointAnimationUsingPath.cs
- WebColorConverter.cs
- GridSplitterAutomationPeer.cs
- BadImageFormatException.cs
- DES.cs
- XmlReturnReader.cs
- ThumbAutomationPeer.cs
- FontEmbeddingManager.cs
- PerfCounters.cs
- CodeCatchClauseCollection.cs
- ConfigurationValidatorAttribute.cs
- GPRECTF.cs
- CacheRequest.cs
- StorageAssociationTypeMapping.cs
- StatusBarDrawItemEvent.cs
- CompositionAdorner.cs
- AsymmetricSignatureDeformatter.cs
- TemplateInstanceAttribute.cs
- EndEvent.cs
- TerminateSequence.cs
- WindowsUpDown.cs
- ToolBarPanel.cs
- SafeCryptoHandles.cs
- IsolatedStorageFileStream.cs
- ModulesEntry.cs
- DataSourceSelectArguments.cs
- FieldNameLookup.cs