Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Base / System / ComponentModel / SortDescriptionCollection.cs / 1 / SortDescriptionCollection.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) 2003 by Microsoft Corporation. All rights reserved.
//
//
//
// Description: dynamic collection of SortDescriptions
//
// See spec at http://avalon/connecteddata/Specs/CollectionView.mht
//
// History:
// 03/24/2005 : [....] - created
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Windows;
using MS.Utility;
namespace System.ComponentModel
{
///
/// Implementation of a dynamic data collection of SortDescriptions.
///
public class SortDescriptionCollection : Collection, INotifyCollectionChanged
{
//-----------------------------------------------------
//
// Public Events
//
//-----------------------------------------------------
#region Public Events
///
/// Occurs when the collection changes, either by adding or removing an item.
///
///
/// see
///
event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged
{
add
{
CollectionChanged += value;
}
remove
{
CollectionChanged -= value;
}
}
///
/// Occurs when the collection changes, either by adding or removing an item.
///
protected event NotifyCollectionChangedEventHandler CollectionChanged;
#endregion Public Events
//------------------------------------------------------
//
// Protected Methods
//
//-----------------------------------------------------
#region Protected Methods
///
/// called by base class Collection<T> when the list is being cleared;
/// raises a CollectionChanged event to any listeners
///
protected override void ClearItems()
{
base.ClearItems();
OnCollectionChanged(NotifyCollectionChangedAction.Reset);
}
///
/// called by base class Collection<T> when an item is removed from list;
/// raises a CollectionChanged event to any listeners
///
protected override void RemoveItem(int index)
{
SortDescription removedItem = this[index];
base.RemoveItem(index);
OnCollectionChanged(NotifyCollectionChangedAction.Remove, removedItem, index);
}
///
/// called by base class Collection<T> when an item is added to list;
/// raises a CollectionChanged event to any listeners
///
protected override void InsertItem(int index, SortDescription item)
{
item.Seal();
base.InsertItem(index, item);
OnCollectionChanged(NotifyCollectionChangedAction.Add, item, index);
}
///
/// called by base class Collection<T> when an item is set in the list;
/// raises a CollectionChanged event to any listeners
///
protected override void SetItem(int index, SortDescription item)
{
item.Seal();
SortDescription originalItem = this[index];
base.SetItem(index, item);
OnCollectionChanged(NotifyCollectionChangedAction.Remove, originalItem, index);
OnCollectionChanged(NotifyCollectionChangedAction.Add, item, index);
}
///
/// raise CollectionChanged event to any listeners
///
private void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index)
{
if (CollectionChanged != null)
{
CollectionChanged(this, new NotifyCollectionChangedEventArgs(action, item, index));
}
}
// raise CollectionChanged event to any listeners
void OnCollectionChanged(NotifyCollectionChangedAction action)
{
if (CollectionChanged != null)
{
CollectionChanged(this, new NotifyCollectionChangedEventArgs(action));
}
}
#endregion Protected Methods
///
/// Immutable, read-only SortDescriptionCollection
///
class EmptySortDescriptionCollection : SortDescriptionCollection, IList
{
//------------------------------------------------------
//
// Protected Methods
//
//------------------------------------------------------
#region Protected Methods
///
/// called by base class Collection<T> when the list is being cleared;
/// raises a CollectionChanged event to any listeners
///
protected override void ClearItems()
{
throw new NotSupportedException();
}
///
/// called by base class Collection<T> when an item is removed from list;
/// raises a CollectionChanged event to any listeners
///
protected override void RemoveItem(int index)
{
throw new NotSupportedException();
}
///
/// called by base class Collection<T> when an item is added to list;
/// raises a CollectionChanged event to any listeners
///
protected override void InsertItem(int index, SortDescription item)
{
throw new NotSupportedException();
}
///
/// called by base class Collection<T> when an item is set in list;
/// raises a CollectionChanged event to any listeners
///
protected override void SetItem(int index, SortDescription item)
{
throw new NotSupportedException();
}
#endregion Protected Methods
#region IList Implementations
// explicit implementation to override the IsReadOnly and IsFixedSize properties
bool IList.IsFixedSize
{
get { return true; }
}
bool IList.IsReadOnly
{
get { return true; }
}
#endregion IList Implementations
}
///
/// returns an empty and non-modifiable SortDescriptionCollection
///
public static readonly SortDescriptionCollection Empty = new EmptySortDescriptionCollection();
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) 2003 by Microsoft Corporation. All rights reserved.
//
//
//
// Description: dynamic collection of SortDescriptions
//
// See spec at http://avalon/connecteddata/Specs/CollectionView.mht
//
// History:
// 03/24/2005 : [....] - created
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Windows;
using MS.Utility;
namespace System.ComponentModel
{
///
/// Implementation of a dynamic data collection of SortDescriptions.
///
public class SortDescriptionCollection : Collection, INotifyCollectionChanged
{
//-----------------------------------------------------
//
// Public Events
//
//-----------------------------------------------------
#region Public Events
///
/// Occurs when the collection changes, either by adding or removing an item.
///
///
/// see
///
event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged
{
add
{
CollectionChanged += value;
}
remove
{
CollectionChanged -= value;
}
}
///
/// Occurs when the collection changes, either by adding or removing an item.
///
protected event NotifyCollectionChangedEventHandler CollectionChanged;
#endregion Public Events
//------------------------------------------------------
//
// Protected Methods
//
//-----------------------------------------------------
#region Protected Methods
///
/// called by base class Collection<T> when the list is being cleared;
/// raises a CollectionChanged event to any listeners
///
protected override void ClearItems()
{
base.ClearItems();
OnCollectionChanged(NotifyCollectionChangedAction.Reset);
}
///
/// called by base class Collection<T> when an item is removed from list;
/// raises a CollectionChanged event to any listeners
///
protected override void RemoveItem(int index)
{
SortDescription removedItem = this[index];
base.RemoveItem(index);
OnCollectionChanged(NotifyCollectionChangedAction.Remove, removedItem, index);
}
///
/// called by base class Collection<T> when an item is added to list;
/// raises a CollectionChanged event to any listeners
///
protected override void InsertItem(int index, SortDescription item)
{
item.Seal();
base.InsertItem(index, item);
OnCollectionChanged(NotifyCollectionChangedAction.Add, item, index);
}
///
/// called by base class Collection<T> when an item is set in the list;
/// raises a CollectionChanged event to any listeners
///
protected override void SetItem(int index, SortDescription item)
{
item.Seal();
SortDescription originalItem = this[index];
base.SetItem(index, item);
OnCollectionChanged(NotifyCollectionChangedAction.Remove, originalItem, index);
OnCollectionChanged(NotifyCollectionChangedAction.Add, item, index);
}
///
/// raise CollectionChanged event to any listeners
///
private void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index)
{
if (CollectionChanged != null)
{
CollectionChanged(this, new NotifyCollectionChangedEventArgs(action, item, index));
}
}
// raise CollectionChanged event to any listeners
void OnCollectionChanged(NotifyCollectionChangedAction action)
{
if (CollectionChanged != null)
{
CollectionChanged(this, new NotifyCollectionChangedEventArgs(action));
}
}
#endregion Protected Methods
///
/// Immutable, read-only SortDescriptionCollection
///
class EmptySortDescriptionCollection : SortDescriptionCollection, IList
{
//------------------------------------------------------
//
// Protected Methods
//
//------------------------------------------------------
#region Protected Methods
///
/// called by base class Collection<T> when the list is being cleared;
/// raises a CollectionChanged event to any listeners
///
protected override void ClearItems()
{
throw new NotSupportedException();
}
///
/// called by base class Collection<T> when an item is removed from list;
/// raises a CollectionChanged event to any listeners
///
protected override void RemoveItem(int index)
{
throw new NotSupportedException();
}
///
/// called by base class Collection<T> when an item is added to list;
/// raises a CollectionChanged event to any listeners
///
protected override void InsertItem(int index, SortDescription item)
{
throw new NotSupportedException();
}
///
/// called by base class Collection<T> when an item is set in list;
/// raises a CollectionChanged event to any listeners
///
protected override void SetItem(int index, SortDescription item)
{
throw new NotSupportedException();
}
#endregion Protected Methods
#region IList Implementations
// explicit implementation to override the IsReadOnly and IsFixedSize properties
bool IList.IsFixedSize
{
get { return true; }
}
bool IList.IsReadOnly
{
get { return true; }
}
#endregion IList Implementations
}
///
/// returns an empty and non-modifiable SortDescriptionCollection
///
public static readonly SortDescriptionCollection Empty = new EmptySortDescriptionCollection();
}
}
// 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
- CalendarDataBindingHandler.cs
- FileEnumerator.cs
- EdmSchemaAttribute.cs
- VBCodeProvider.cs
- HierarchicalDataBoundControlAdapter.cs
- FullTextLine.cs
- DependencyStoreSurrogate.cs
- TypedTableBaseExtensions.cs
- Model3DGroup.cs
- XmlExtensionFunction.cs
- IntSecurity.cs
- BitmapEffectGroup.cs
- TypeDescriptor.cs
- RenderCapability.cs
- NegationPusher.cs
- HierarchicalDataBoundControl.cs
- ColorComboBox.cs
- MsmqIntegrationBinding.cs
- ViewKeyConstraint.cs
- BezierSegment.cs
- EntityDataSourceChangingEventArgs.cs
- NoResizeSelectionBorderGlyph.cs
- AppSecurityManager.cs
- StylusOverProperty.cs
- UnsafeNativeMethods.cs
- SystemIcmpV6Statistics.cs
- XmlStringTable.cs
- HttpProfileGroupBase.cs
- ActivationArguments.cs
- HttpFileCollection.cs
- Interop.cs
- SecurityTokenResolver.cs
- ObjectListCommandCollection.cs
- ContainerParaClient.cs
- ObjectAnimationUsingKeyFrames.cs
- SiteMap.cs
- WebPartExportVerb.cs
- _DomainName.cs
- ShowExpandedMultiValueConverter.cs
- Graph.cs
- SchemaNames.cs
- MenuItemCollection.cs
- DotExpr.cs
- ReadOnlyDictionary.cs
- RectangleConverter.cs
- InputProcessorProfiles.cs
- MarkupObject.cs
- VisualBasicSettingsHandler.cs
- Application.cs
- InternalsVisibleToAttribute.cs
- XmlLinkedNode.cs
- IsolatedStoragePermission.cs
- AsymmetricAlgorithm.cs
- QuaternionAnimationBase.cs
- WebPartEventArgs.cs
- Random.cs
- BinaryObjectReader.cs
- BamlResourceDeserializer.cs
- ObfuscationAttribute.cs
- MetadataArtifactLoaderResource.cs
- SelectionEditor.cs
- DataBinder.cs
- FreezableOperations.cs
- HtmlTableCell.cs
- ConstraintEnumerator.cs
- GlobalProxySelection.cs
- TextElementAutomationPeer.cs
- InstanceLockLostException.cs
- CodeDelegateCreateExpression.cs
- BasicHttpSecurityMode.cs
- DuplicateMessageDetector.cs
- ThreadPool.cs
- regiisutil.cs
- TcpClientChannel.cs
- BitStream.cs
- VectorCollectionValueSerializer.cs
- EmbeddedObject.cs
- ServiceElementCollection.cs
- NamespaceEmitter.cs
- Matrix3DStack.cs
- AsyncOperation.cs
- DataGridViewTextBoxColumn.cs
- UseLicense.cs
- Activity.cs
- ClientProxyGenerator.cs
- StylusDevice.cs
- ArraySet.cs
- Pointer.cs
- CacheEntry.cs
- ClientEndpointLoader.cs
- SizeAnimationClockResource.cs
- ChildrenQuery.cs
- SqlDataReaderSmi.cs
- GridViewUpdateEventArgs.cs
- Attributes.cs
- ProcessHostConfigUtils.cs
- FixedSOMLineCollection.cs
- InfoCardTraceRecord.cs
- SetMemberBinder.cs
- XmlExtensionFunction.cs