Code:
/ 4.0 / 4.0 / 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 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
- ValueChangedEventManager.cs
- Int32KeyFrameCollection.cs
- activationcontext.cs
- DataViewManager.cs
- ProgressPage.cs
- RegexCompilationInfo.cs
- DownloadProgressEventArgs.cs
- TextAutomationPeer.cs
- GenericUI.cs
- EdmToObjectNamespaceMap.cs
- SafeSerializationManager.cs
- ProfileInfo.cs
- CrossContextChannel.cs
- XmlUTF8TextReader.cs
- HasRunnableWorkflowEvent.cs
- PathStreamGeometryContext.cs
- Stylesheet.cs
- TextRangeAdaptor.cs
- RealizedColumnsBlock.cs
- Subtree.cs
- RbTree.cs
- SharedDp.cs
- AppModelKnownContentFactory.cs
- EmptyEnumerable.cs
- MediaContext.cs
- CodeExporter.cs
- HtmlGenericControl.cs
- ArithmeticException.cs
- XmlValidatingReaderImpl.cs
- XmlAttributeProperties.cs
- RecordConverter.cs
- HostedElements.cs
- ObjectStateFormatter.cs
- DataTableMappingCollection.cs
- FSWPathEditor.cs
- NotifyParentPropertyAttribute.cs
- TableItemStyle.cs
- AbandonedMutexException.cs
- Menu.cs
- SqlDependencyUtils.cs
- XmlSiteMapProvider.cs
- SqlCacheDependency.cs
- GridView.cs
- JavascriptCallbackMessageInspector.cs
- ResourceDescriptionAttribute.cs
- NavigationPropertySingletonExpression.cs
- TextBounds.cs
- ProfileService.cs
- ImageMetadata.cs
- _SslSessionsCache.cs
- SerialErrors.cs
- ResourceAssociationTypeEnd.cs
- SpecularMaterial.cs
- CleanUpVirtualizedItemEventArgs.cs
- UserMapPath.cs
- BinHexDecoder.cs
- SystemIPAddressInformation.cs
- StringExpressionSet.cs
- HybridObjectCache.cs
- GregorianCalendarHelper.cs
- ErrorLog.cs
- COM2PictureConverter.cs
- exports.cs
- EmptyEnumerator.cs
- ProcessMonitor.cs
- SoapInteropTypes.cs
- _OSSOCK.cs
- BindingExpressionUncommonField.cs
- ProtocolsConfiguration.cs
- ToolBarButtonClickEvent.cs
- CharacterMetrics.cs
- ChtmlImageAdapter.cs
- StringCollection.cs
- xsdvalidator.cs
- IDReferencePropertyAttribute.cs
- NavigationPropertyAccessor.cs
- DoubleCollection.cs
- RequestValidator.cs
- SamlAuthenticationStatement.cs
- ArcSegment.cs
- Choices.cs
- ConfigUtil.cs
- DispatchWrapper.cs
- SQLBinary.cs
- TdsRecordBufferSetter.cs
- MembershipUser.cs
- SymLanguageType.cs
- UnitControl.cs
- SQLBinary.cs
- UnsafeNativeMethods.cs
- PixelFormats.cs
- CancelEventArgs.cs
- MatrixAnimationUsingKeyFrames.cs
- ObjectCache.cs
- TextTreeNode.cs
- XmlSchemaGroup.cs
- WinFormsUtils.cs
- PatternMatchRules.cs
- XamlReader.cs
- DockPattern.cs