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
- BinHexDecoder.cs
- SyndicationDeserializer.cs
- AnnotationResourceChangedEventArgs.cs
- WasNotInstalledException.cs
- ShapeTypeface.cs
- _SafeNetHandles.cs
- XmlWhitespace.cs
- CultureSpecificStringDictionary.cs
- xmlsaver.cs
- ClientRolePrincipal.cs
- Size.cs
- OutputCacheSection.cs
- mactripleDES.cs
- PropertyMetadata.cs
- HwndAppCommandInputProvider.cs
- FontStretches.cs
- SqlBulkCopyColumnMappingCollection.cs
- ExtendedProtectionPolicyElement.cs
- FileChangeNotifier.cs
- ScriptReference.cs
- UndoManager.cs
- XmlSchemaProviderAttribute.cs
- ToolStripDropDownItem.cs
- EdmSchemaAttribute.cs
- WebPartTransformerCollection.cs
- pingexception.cs
- EncoderExceptionFallback.cs
- DataControlImageButton.cs
- PackageProperties.cs
- TypeUtils.cs
- MenuItemBinding.cs
- ClientBuildManagerCallback.cs
- MenuItemCollectionEditorDialog.cs
- TraceHwndHost.cs
- CapiHashAlgorithm.cs
- PolicyManager.cs
- ConversionValidationRule.cs
- ConcurrencyBehavior.cs
- HttpValueCollection.cs
- ObjectDataSourceView.cs
- NavigationProperty.cs
- DynamicValueConverter.cs
- LocalizabilityAttribute.cs
- PagedDataSource.cs
- QilStrConcat.cs
- OdbcStatementHandle.cs
- SimpleExpression.cs
- BoundField.cs
- ReservationCollection.cs
- ColorConvertedBitmap.cs
- CodeIdentifier.cs
- SqlLiftIndependentRowExpressions.cs
- WSSecurityXXX2005.cs
- ProtocolsConfigurationHandler.cs
- SocketPermission.cs
- SqlDataSourceCache.cs
- MemoryStream.cs
- VisualCollection.cs
- PluggableProtocol.cs
- VerificationAttribute.cs
- SqlInternalConnectionTds.cs
- infer.cs
- ComplexTypeEmitter.cs
- RoutedPropertyChangedEventArgs.cs
- MessageDescriptionCollection.cs
- WebPartConnectionsCloseVerb.cs
- DbConnectionStringCommon.cs
- StorageScalarPropertyMapping.cs
- ExpressionQuoter.cs
- PropertySegmentSerializer.cs
- PlainXmlDeserializer.cs
- ThreadAttributes.cs
- KeyEvent.cs
- InternalsVisibleToAttribute.cs
- MsmqOutputMessage.cs
- PeerCollaboration.cs
- FacetDescriptionElement.cs
- PriorityQueue.cs
- PartialTrustVisibleAssemblyCollection.cs
- XmlAttributeAttribute.cs
- Switch.cs
- NetCodeGroup.cs
- ConfigsHelper.cs
- TrackingValidationObjectDictionary.cs
- ClientSettingsSection.cs
- XPathParser.cs
- x509store.cs
- ComAdminInterfaces.cs
- Message.cs
- ScriptReferenceBase.cs
- errorpatternmatcher.cs
- KeyValueConfigurationCollection.cs
- HttpResponse.cs
- DataSourceSerializationException.cs
- MaterialCollection.cs
- PaginationProgressEventArgs.cs
- Int16AnimationUsingKeyFrames.cs
- Control.cs
- ToolStripHighContrastRenderer.cs
- DocumentScope.cs