Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Documents / SpellerError.cs / 1305600 / SpellerError.cs
//----------------------------------------------------------------------------
//
// File: SpellerError.cs
//
// Description: A misspelled word in a TextBox or RichTextBox.
//
//---------------------------------------------------------------------------
namespace System.Windows.Controls
{
using System.Collections;
using System.Collections.Generic;
using System.Windows.Documents;
using MS.Internal;
///
/// A misspelled word in a TextBox or RichTextBox.
///
public class SpellingError
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
// Creates a new instance.
internal SpellingError(Speller speller, ITextPointer start, ITextPointer end)
{
Invariant.Assert(start.CompareTo(end) < 0);
_speller = speller;
_start = start.GetFrozenPointer(LogicalDirection.Forward);
_end = end.GetFrozenPointer(LogicalDirection.Backward);
}
#endregion Constructors
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
#region Public Methods
///
/// Replaces the spelling error text with a specificed correction.
///
///
/// Text to replace the error.
///
///
/// This method repositions the caret to the position immediately
/// following the corrected text.
///
public void Correct(string correctedText)
{
if (correctedText == null)
{
correctedText = String.Empty; // Parity with TextBox.Text.
}
ITextRange range = new TextRange(_start, _end);
range.Text = correctedText;
}
///
/// Instructs the control to ignore this error and any duplicates for
/// the remainder of its lifetime.
///
public void IgnoreAll()
{
_speller.IgnoreAll(TextRangeBase.GetTextInternal(_start, _end));
}
#endregion Public methods
//------------------------------------------------------
//
// Public Properties
//
//------------------------------------------------------
#region Public Properties
///
/// A list of suggested replaced for the misspelled text.
///
///
/// May be empty, meaning no suggestions are available.
///
public IEnumerable Suggestions
{
get
{
IList suggestions = _speller.GetSuggestionsForError(this);
for (int i=0; i
/// Start position of the misspelled text.
///
internal ITextPointer Start
{
get
{
return _start;
}
}
///
/// End position of the misspelled text.
///
internal ITextPointer End
{
get
{
return _end;
}
}
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
// Speller associated with this error.
private readonly Speller _speller;
// Start position of the error text.
private readonly ITextPointer _start;
// End position of the error text.
private readonly ITextPointer _end;
#endregion Private Fields
}
}
// 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
- ClientSideQueueItem.cs
- ItemsControlAutomationPeer.cs
- ResourceCategoryAttribute.cs
- BooleanProjectedSlot.cs
- InstanceOwner.cs
- SoapIncludeAttribute.cs
- InkCanvas.cs
- XmlSchemaAnyAttribute.cs
- PropertyPath.cs
- XmlDocumentFragment.cs
- ListSortDescriptionCollection.cs
- InternalConfigHost.cs
- MembershipValidatePasswordEventArgs.cs
- InvalidCastException.cs
- uribuilder.cs
- RMEnrollmentPage2.cs
- BinaryParser.cs
- SqlBuilder.cs
- DataServiceProviderMethods.cs
- IndexedString.cs
- MemoryRecordBuffer.cs
- XPathDocumentNavigator.cs
- ComplexType.cs
- ISFTagAndGuidCache.cs
- PassportAuthentication.cs
- XmlSchemaInfo.cs
- XmlReflectionImporter.cs
- WebRequestModuleElement.cs
- InvalidCommandTreeException.cs
- TextModifierScope.cs
- LightweightCodeGenerator.cs
- XmlUnspecifiedAttribute.cs
- Permission.cs
- ActivityExecutorDelegateInfo.cs
- OutOfProcStateClientManager.cs
- EventRoute.cs
- TableCell.cs
- CreatingCookieEventArgs.cs
- DrawingGroupDrawingContext.cs
- XmlDocument.cs
- HttpModuleAction.cs
- FixedSOMTextRun.cs
- InfoCardServiceInstallComponent.cs
- DataGridTextBox.cs
- UIElementIsland.cs
- X509ChainPolicy.cs
- ItemMap.cs
- SqlDataSourceRefreshSchemaForm.cs
- Tablet.cs
- TripleDES.cs
- basemetadatamappingvisitor.cs
- InkCanvasSelection.cs
- TextTreeRootTextBlock.cs
- AnnotationObservableCollection.cs
- RIPEMD160.cs
- GenericEnumConverter.cs
- Graph.cs
- QilParameter.cs
- PointF.cs
- DesignerHelpers.cs
- Property.cs
- M3DUtil.cs
- SoapIncludeAttribute.cs
- ScriptReference.cs
- TypeContext.cs
- SecurityManager.cs
- BufferModeSettings.cs
- FileDialogPermission.cs
- _SafeNetHandles.cs
- HtmlSelect.cs
- ManagementExtension.cs
- MonthChangedEventArgs.cs
- RangeContentEnumerator.cs
- IDReferencePropertyAttribute.cs
- DisplayToken.cs
- CombinedGeometry.cs
- GridView.cs
- ExtendedProtectionPolicyTypeConverter.cs
- TextShapeableCharacters.cs
- ConfigWriter.cs
- QueryReaderSettings.cs
- UnmanagedMemoryStreamWrapper.cs
- Variant.cs
- RuntimeCompatibilityAttribute.cs
- MenuItemStyle.cs
- Attributes.cs
- ValueCollectionParameterReader.cs
- InvalidDataException.cs
- EdgeModeValidation.cs
- ValidationError.cs
- SapiRecoContext.cs
- IndexOutOfRangeException.cs
- Figure.cs
- RelativeSource.cs
- StandardCommands.cs
- CookielessData.cs
- uribuilder.cs
- AsyncPostBackTrigger.cs
- SqlPersonalizationProvider.cs
- Identity.cs