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 / TextChangedEventArgs.cs / 1 / TextChangedEventArgs.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: TextChanged event argument.
//
// History:
// 09/27/2004 : psarrett - Created
//
//---------------------------------------------------------------------------
using System.ComponentModel;
using System.Windows.Documents;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace System.Windows.Controls
{
#region TextChangedEvent
///
/// How the undo stack caused or is affected by a text change.
///
public enum UndoAction
{
///
/// This change will not affect the undo stack at all
///
None = 0,
///
/// This change will merge into the previous undo unit
///
Merge = 1,
///
/// This change is the result of a call to Undo()
///
Undo = 2,
///
/// This change is the result of a call to Redo()
///
Redo = 3,
///
/// This change will clear the undo stack
///
Clear = 4,
///
/// This change will create a new undo unit
///
Create = 5
}
///
/// The delegate to use for handlers that receive TextChangedEventArgs
///
public delegate void TextChangedEventHandler(object sender, TextChangedEventArgs e);
///
/// The TextChangedEventArgs class represents a type of RoutedEventArgs that
/// are relevant to events raised by changing editable text.
///
public class TextChangedEventArgs : RoutedEventArgs
{
///
/// constructor
///
/// event id
/// UndoAction
/// ReadOnlyCollection
public TextChangedEventArgs(RoutedEvent id, UndoAction action, ICollection changes) : base()
{
if (id == null)
{
throw new ArgumentNullException("id");
}
if (action < UndoAction.None || action > UndoAction.Create)
{
throw new InvalidEnumArgumentException("action", (int)action, typeof(UndoAction));
}
RoutedEvent=id;
_undoAction = action;
_changes = changes;
}
///
/// constructor
///
/// event id
/// UndoAction
public TextChangedEventArgs(RoutedEvent id, UndoAction action)
: this(id, action, new ReadOnlyCollection(new List()))
{
}
///
/// How the undo stack caused or is affected by this text change
///
/// UndoAction enum
public UndoAction UndoAction
{
get
{
return _undoAction;
}
}
///
/// A readonly list of TextChanges, sorted by offset in order from the beginning to the end of
/// the document, describing the dirty areas of the document and in what way(s) those
/// areas differ from the pre-change document. For example, if content at offset 0 was:
///
/// The quick brown fox jumps over the lazy dog.
///
/// and changed to:
///
/// The brown fox jumps over a dog.
///
/// Changes would contain two TextChanges with the following information:
///
/// Change 1
/// --------
/// Offset: 5
/// RemovedCount: 6
/// AddedCount: 0
/// PropertyCount: 0
///
/// Change 2
/// --------
/// Offset: 26
/// RemovedCount: 8
/// AddedCount: 1
/// PropertyCount: 0
///
/// If no changes were made, the collection will be empty.
///
public ICollection Changes
{
get
{
return _changes;
}
}
///
/// The mechanism used to call the type-specific handler on the
/// target.
///
///
/// The generic handler to call in a type-specific way.
///
///
/// The target to call the handler on.
///
protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget)
{
TextChangedEventHandler handler;
handler = (TextChangedEventHandler)genericHandler;
handler(genericTarget, this);
}
private UndoAction _undoAction;
private readonly ICollection _changes;
}
#endregion TextChangedEvent
}
// 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.
//
//
//
// Description: TextChanged event argument.
//
// History:
// 09/27/2004 : psarrett - Created
//
//---------------------------------------------------------------------------
using System.ComponentModel;
using System.Windows.Documents;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace System.Windows.Controls
{
#region TextChangedEvent
///
/// How the undo stack caused or is affected by a text change.
///
public enum UndoAction
{
///
/// This change will not affect the undo stack at all
///
None = 0,
///
/// This change will merge into the previous undo unit
///
Merge = 1,
///
/// This change is the result of a call to Undo()
///
Undo = 2,
///
/// This change is the result of a call to Redo()
///
Redo = 3,
///
/// This change will clear the undo stack
///
Clear = 4,
///
/// This change will create a new undo unit
///
Create = 5
}
///
/// The delegate to use for handlers that receive TextChangedEventArgs
///
public delegate void TextChangedEventHandler(object sender, TextChangedEventArgs e);
///
/// The TextChangedEventArgs class represents a type of RoutedEventArgs that
/// are relevant to events raised by changing editable text.
///
public class TextChangedEventArgs : RoutedEventArgs
{
///
/// constructor
///
/// event id
/// UndoAction
/// ReadOnlyCollection
public TextChangedEventArgs(RoutedEvent id, UndoAction action, ICollection changes) : base()
{
if (id == null)
{
throw new ArgumentNullException("id");
}
if (action < UndoAction.None || action > UndoAction.Create)
{
throw new InvalidEnumArgumentException("action", (int)action, typeof(UndoAction));
}
RoutedEvent=id;
_undoAction = action;
_changes = changes;
}
///
/// constructor
///
/// event id
/// UndoAction
public TextChangedEventArgs(RoutedEvent id, UndoAction action)
: this(id, action, new ReadOnlyCollection(new List()))
{
}
///
/// How the undo stack caused or is affected by this text change
///
/// UndoAction enum
public UndoAction UndoAction
{
get
{
return _undoAction;
}
}
///
/// A readonly list of TextChanges, sorted by offset in order from the beginning to the end of
/// the document, describing the dirty areas of the document and in what way(s) those
/// areas differ from the pre-change document. For example, if content at offset 0 was:
///
/// The quick brown fox jumps over the lazy dog.
///
/// and changed to:
///
/// The brown fox jumps over a dog.
///
/// Changes would contain two TextChanges with the following information:
///
/// Change 1
/// --------
/// Offset: 5
/// RemovedCount: 6
/// AddedCount: 0
/// PropertyCount: 0
///
/// Change 2
/// --------
/// Offset: 26
/// RemovedCount: 8
/// AddedCount: 1
/// PropertyCount: 0
///
/// If no changes were made, the collection will be empty.
///
public ICollection Changes
{
get
{
return _changes;
}
}
///
/// The mechanism used to call the type-specific handler on the
/// target.
///
///
/// The generic handler to call in a type-specific way.
///
///
/// The target to call the handler on.
///
protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget)
{
TextChangedEventHandler handler;
handler = (TextChangedEventHandler)genericHandler;
handler(genericTarget, this);
}
private UndoAction _undoAction;
private readonly ICollection _changes;
}
#endregion TextChangedEvent
}
// 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
- GridViewRowPresenterBase.cs
- ObjectStateFormatter.cs
- ManualResetEventSlim.cs
- IPeerNeighbor.cs
- xmlfixedPageInfo.cs
- Size.cs
- ManagedIStream.cs
- Tokenizer.cs
- CompilerErrorCollection.cs
- DayRenderEvent.cs
- DnsPermission.cs
- IpcClientManager.cs
- SystemResourceKey.cs
- AdRotatorDesigner.cs
- CustomErrorsSectionWrapper.cs
- DataGridViewColumnCollection.cs
- XsltFunctions.cs
- DataBindingCollection.cs
- ThreadInterruptedException.cs
- CellParagraph.cs
- UInt64.cs
- Page.cs
- ResourcePermissionBaseEntry.cs
- UrlMappingCollection.cs
- MergablePropertyAttribute.cs
- ProviderException.cs
- PersonalizationAdministration.cs
- PersonalizationProviderCollection.cs
- MemberInfoSerializationHolder.cs
- FileDialog.cs
- Crc32Helper.cs
- TransformConverter.cs
- ThreadStaticAttribute.cs
- TTSEngineProxy.cs
- QueryOutputWriter.cs
- HttpCacheVaryByContentEncodings.cs
- StringToken.cs
- Odbc32.cs
- GridViewSelectEventArgs.cs
- IERequestCache.cs
- WindowsPen.cs
- ProfileBuildProvider.cs
- LocalIdCollection.cs
- ModifierKeysValueSerializer.cs
- TransactionalPackage.cs
- IsolatedStorageFileStream.cs
- FrameworkContentElementAutomationPeer.cs
- Error.cs
- ConfigurationSettings.cs
- BinaryUtilClasses.cs
- Variant.cs
- SHA384Managed.cs
- SchemeSettingElementCollection.cs
- Font.cs
- AspCompat.cs
- StreamGeometry.cs
- TextViewBase.cs
- HtmlElement.cs
- IsolatedStorageFileStream.cs
- TextLine.cs
- FileDialog_Vista_Interop.cs
- CodeDirectoryCompiler.cs
- ExportException.cs
- Stylus.cs
- ConnectionPoolManager.cs
- ConsoleKeyInfo.cs
- InnerItemCollectionView.cs
- SystemParameters.cs
- XmlSchemaCompilationSettings.cs
- RemoteWebConfigurationHost.cs
- Geometry3D.cs
- FontStretch.cs
- RectValueSerializer.cs
- SiblingIterators.cs
- SQLSingleStorage.cs
- ErrorTableItemStyle.cs
- CacheSection.cs
- EventHandlerService.cs
- WaitHandleCannotBeOpenedException.cs
- AsymmetricKeyExchangeFormatter.cs
- listviewsubitemcollectioneditor.cs
- AuthenticationServiceManager.cs
- Block.cs
- PersonalizationAdministration.cs
- BitmapPalette.cs
- _ShellExpression.cs
- GenericAuthenticationEventArgs.cs
- FrameAutomationPeer.cs
- StylusPointCollection.cs
- XmlSchemaParticle.cs
- XamlFilter.cs
- DPAPIProtectedConfigurationProvider.cs
- StoreItemCollection.cs
- ResourceSet.cs
- PenContexts.cs
- LinqExpressionNormalizer.cs
- XmlSerializationGeneratedCode.cs
- MatrixStack.cs
- WindowsSpinner.cs
- MembershipUser.cs