Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / Documents / SpellerError.cs / 1 / 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 IEnumerableSuggestions { 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. //---------------------------------------------------------------------------- // // 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 IEnumerableSuggestions { 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
- DmlSqlGenerator.cs
- NetStream.cs
- Rijndael.cs
- XmlToDatasetMap.cs
- UIElementIsland.cs
- DependencySource.cs
- CompoundFileDeflateTransform.cs
- DefaultShape.cs
- MouseButtonEventArgs.cs
- webbrowsersite.cs
- BehaviorEditorPart.cs
- MarginsConverter.cs
- SystemWebCachingSectionGroup.cs
- TreeNodeCollectionEditor.cs
- MetadataPropertyvalue.cs
- DynamicPropertyReader.cs
- XmlSchemaSubstitutionGroup.cs
- ResourceSet.cs
- RoleProviderPrincipal.cs
- HtmlFormWrapper.cs
- ObjectDataSourceStatusEventArgs.cs
- CatalogPartCollection.cs
- ObjRef.cs
- TextPattern.cs
- AxHost.cs
- BmpBitmapEncoder.cs
- StateWorkerRequest.cs
- XamlVector3DCollectionSerializer.cs
- DistinctQueryOperator.cs
- DateTimeValueSerializer.cs
- AutoFocusStyle.xaml.cs
- MULTI_QI.cs
- WebService.cs
- FontFamilyIdentifier.cs
- ExpanderAutomationPeer.cs
- FixedSOMSemanticBox.cs
- TemplateNodeContextMenu.cs
- SimpleTypeResolver.cs
- MsmqProcessProtocolHandler.cs
- AssociationTypeEmitter.cs
- Renderer.cs
- BinaryCommonClasses.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- SessionStateUtil.cs
- ScopelessEnumAttribute.cs
- ControlType.cs
- Transactions.cs
- IIS7UserPrincipal.cs
- ProtocolsSection.cs
- ServicePointManager.cs
- InputQueue.cs
- ScrollViewerAutomationPeer.cs
- WorkflowPersistenceService.cs
- WindowInteractionStateTracker.cs
- GuidelineCollection.cs
- StringUtil.cs
- SchemaElement.cs
- WindowsListView.cs
- ImageBrush.cs
- RemoteWebConfigurationHost.cs
- ReflectPropertyDescriptor.cs
- RichTextBoxDesigner.cs
- ThreadPool.cs
- LocationUpdates.cs
- sitestring.cs
- RSACryptoServiceProvider.cs
- PageThemeBuildProvider.cs
- DiffuseMaterial.cs
- RequestCacheManager.cs
- ChildrenQuery.cs
- Pens.cs
- ThreadNeutralSemaphore.cs
- FramingFormat.cs
- SqlGatherConsumedAliases.cs
- _FixedSizeReader.cs
- MetabaseServerConfig.cs
- GC.cs
- SerializationFieldInfo.cs
- DbConnectionPoolGroupProviderInfo.cs
- XpsSerializationManagerAsync.cs
- BitmapImage.cs
- WindowsListViewScroll.cs
- SqlUDTStorage.cs
- Point3DKeyFrameCollection.cs
- _ConnectStream.cs
- PrincipalPermission.cs
- JulianCalendar.cs
- ItemContainerGenerator.cs
- NativeMethods.cs
- OdbcCommand.cs
- Double.cs
- DiagnosticTraceSource.cs
- LinkLabel.cs
- ErrorItem.cs
- XmlUtf8RawTextWriter.cs
- XamlToRtfParser.cs
- BindingListCollectionView.cs
- XmlSchemaImport.cs
- GenericWebPart.cs
- SQLGuidStorage.cs