Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- ExpressionVisitor.cs
- GenericIdentity.cs
- SchemaTypeEmitter.cs
- ArrangedElementCollection.cs
- SystemWebExtensionsSectionGroup.cs
- TextBoxAutomationPeer.cs
- BrowserDefinition.cs
- MaterialGroup.cs
- PriorityQueue.cs
- DetailsViewDeleteEventArgs.cs
- DefaultHttpHandler.cs
- XmlParser.cs
- FormatPage.cs
- Calendar.cs
- BasePattern.cs
- PaintValueEventArgs.cs
- MemoryRecordBuffer.cs
- InvalidPrinterException.cs
- JsonServiceDocumentSerializer.cs
- RelationshipEndMember.cs
- FactoryGenerator.cs
- XPathNavigator.cs
- InheritanceRules.cs
- GridItemPattern.cs
- TableCell.cs
- RepeaterItem.cs
- TextOnlyOutput.cs
- OleDbConnection.cs
- NativeActivityMetadata.cs
- FlowDocumentReaderAutomationPeer.cs
- ContentValidator.cs
- ClientSettingsStore.cs
- XPathNodeInfoAtom.cs
- NotCondition.cs
- OptimalTextSource.cs
- SamlAssertionKeyIdentifierClause.cs
- XmlCharCheckingWriter.cs
- WorkflowServiceBehavior.cs
- CharEnumerator.cs
- OracleMonthSpan.cs
- DockAndAnchorLayout.cs
- NullableFloatSumAggregationOperator.cs
- Documentation.cs
- ValidatorUtils.cs
- ServerIdentity.cs
- ComponentManagerBroker.cs
- TypedTableBase.cs
- TextFormatterHost.cs
- BindingsCollection.cs
- XmlReaderSettings.cs
- ScrollableControl.cs
- SchemaObjectWriter.cs
- EntityDesignerBuildProvider.cs
- HMACSHA1.cs
- RegistryKey.cs
- ObjectCloneHelper.cs
- ArrayList.cs
- MembershipSection.cs
- EntityKeyElement.cs
- CompositeDataBoundControl.cs
- Tile.cs
- CollectionBase.cs
- PreApplicationStartMethodAttribute.cs
- SafeLibraryHandle.cs
- CodeParameterDeclarationExpression.cs
- TableLayoutPanelCellPosition.cs
- XpsSerializationException.cs
- OdbcUtils.cs
- ContentControl.cs
- xml.cs
- SettingsProperty.cs
- VerificationException.cs
- NativeCppClassAttribute.cs
- PropertyExpression.cs
- DbException.cs
- SecuritySessionSecurityTokenAuthenticator.cs
- CrossAppDomainChannel.cs
- XmlEnumAttribute.cs
- PrtCap_Public_Simple.cs
- SQLDoubleStorage.cs
- XomlSerializationHelpers.cs
- GridView.cs
- _LazyAsyncResult.cs
- Rect3DValueSerializer.cs
- JpegBitmapDecoder.cs
- VisualCollection.cs
- MD5Cng.cs
- StateMachine.cs
- AssemblyResourceLoader.cs
- XmlSchemaIdentityConstraint.cs
- DesignerAttribute.cs
- StatusBar.cs
- SystemColors.cs
- WebConfigManager.cs
- RegexWorker.cs
- SEHException.cs
- WindowsListViewItem.cs
- BitSet.cs
- FixedBufferAttribute.cs
- PageHandlerFactory.cs