Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- X509Certificate2Collection.cs
- AspProxy.cs
- TabItem.cs
- InternalBufferOverflowException.cs
- ItemCheckEvent.cs
- ResXResourceReader.cs
- HttpBrowserCapabilitiesWrapper.cs
- ListBoxItem.cs
- PersonalizationDictionary.cs
- errorpatternmatcher.cs
- TcpConnectionPool.cs
- SpellCheck.cs
- ConfigXmlWhitespace.cs
- EmissiveMaterial.cs
- SelectionEditor.cs
- CommunicationObject.cs
- ParenthesizePropertyNameAttribute.cs
- SqlTransaction.cs
- TimelineClockCollection.cs
- Part.cs
- FindCriteriaApril2005.cs
- XhtmlBasicLinkAdapter.cs
- MultiDataTrigger.cs
- Visual3DCollection.cs
- DataTemplate.cs
- ResumeStoryboard.cs
- ToolStripItemClickedEventArgs.cs
- Internal.cs
- ClientEventManager.cs
- EncoderParameters.cs
- SchemaExporter.cs
- WebException.cs
- QilLoop.cs
- DataGridViewRowEventArgs.cs
- TypeConverterValueSerializer.cs
- Executor.cs
- ControlCollection.cs
- IsolationInterop.cs
- PerformanceCountersElement.cs
- DocumentSequenceHighlightLayer.cs
- QilStrConcatenator.cs
- LookupNode.cs
- Registry.cs
- DecimalAnimationBase.cs
- DesignerLinkAdapter.cs
- ToggleButton.cs
- CapiSymmetricAlgorithm.cs
- MemberInitExpression.cs
- EntityParameterCollection.cs
- TraceSource.cs
- ToolStripDropDown.cs
- ConsoleTraceListener.cs
- ErrorFormatterPage.cs
- CompositeFontInfo.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- JoinTreeSlot.cs
- DataGridCaption.cs
- XmlEnumAttribute.cs
- TypeSource.cs
- XmlHelper.cs
- AddingNewEventArgs.cs
- UnmanagedMemoryStream.cs
- StylusPointPropertyInfoDefaults.cs
- DataPointer.cs
- SingleStorage.cs
- InfoCardArgumentException.cs
- FormattedText.cs
- StateMachineWorkflow.cs
- WindowsTitleBar.cs
- Socket.cs
- AttributeData.cs
- EFColumnProvider.cs
- ConnectionInterfaceCollection.cs
- KeyPressEvent.cs
- WindowsNonControl.cs
- SchemaCollectionPreprocessor.cs
- CLSCompliantAttribute.cs
- ExtendedPropertyCollection.cs
- HtmlToClrEventProxy.cs
- ResourceCollectionInfo.cs
- RegexCapture.cs
- ThousandthOfEmRealPoints.cs
- DiscardableAttribute.cs
- HelpEvent.cs
- FileStream.cs
- DateTimePicker.cs
- OracleDateTime.cs
- OleDragDropHandler.cs
- MultiByteCodec.cs
- SQLByteStorage.cs
- MessageBox.cs
- WindowShowOrOpenTracker.cs
- GroupDescription.cs
- ArcSegment.cs
- WindowProviderWrapper.cs
- MenuItem.cs
- XmlArrayAttribute.cs
- GeneralTransform3DTo2DTo3D.cs
- LinqDataView.cs
- UniqueIdentifierService.cs