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
- CmsInterop.cs
- ContentType.cs
- HandleRef.cs
- PowerModeChangedEventArgs.cs
- TypeResolvingOptions.cs
- ObjectTokenCategory.cs
- Vector.cs
- DSASignatureDeformatter.cs
- BamlTreeMap.cs
- CommonDialog.cs
- LambdaCompiler.Expressions.cs
- listitem.cs
- Exceptions.cs
- InkCanvas.cs
- DecimalConstantAttribute.cs
- TableColumnCollectionInternal.cs
- XmlHierarchyData.cs
- PocoPropertyAccessorStrategy.cs
- ValidationPropertyAttribute.cs
- PerfCounters.cs
- PasswordPropertyTextAttribute.cs
- WindowsAuthenticationEventArgs.cs
- MarkupCompiler.cs
- CodeMemberMethod.cs
- SqlFlattener.cs
- SamlNameIdentifierClaimResource.cs
- CounterCreationDataCollection.cs
- GACMembershipCondition.cs
- FrameworkContentElement.cs
- XmlDataProvider.cs
- RectangleGeometry.cs
- RawStylusInputCustomDataList.cs
- AnnotationResourceChangedEventArgs.cs
- WebControlsSection.cs
- StackSpiller.Bindings.cs
- XmlIlTypeHelper.cs
- FormViewRow.cs
- KeyedCollection.cs
- ConsumerConnectionPoint.cs
- storepermission.cs
- PackageDocument.cs
- UniformGrid.cs
- XpsViewerException.cs
- UInt16Converter.cs
- HitTestParameters.cs
- DiscoveryClientDocuments.cs
- CodeConditionStatement.cs
- OleDbDataReader.cs
- Storyboard.cs
- ListViewCancelEventArgs.cs
- ListParagraph.cs
- XslAstAnalyzer.cs
- ServicePoint.cs
- FileSystemInfo.cs
- DetailsViewPageEventArgs.cs
- SqlOuterApplyReducer.cs
- CallInfo.cs
- MarkedHighlightComponent.cs
- PlatformNotSupportedException.cs
- HTTPNotFoundHandler.cs
- handlecollector.cs
- GrammarBuilderDictation.cs
- CollectionViewGroup.cs
- ComEventsMethod.cs
- MultiTrigger.cs
- XsltLibrary.cs
- WindowPatternIdentifiers.cs
- PrintPreviewDialog.cs
- HttpWebRequestElement.cs
- WorkflowServiceHostFactory.cs
- HtmlInputRadioButton.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- SQLByteStorage.cs
- ObjectSelectorEditor.cs
- GridView.cs
- XamlBuildProvider.cs
- XmlSchemaException.cs
- Knowncolors.cs
- XmlSignatureProperties.cs
- IgnoreFlushAndCloseStream.cs
- DataGridViewImageCell.cs
- WebPartZoneCollection.cs
- ChannelEndpointElement.cs
- DefaultWorkflowTransactionService.cs
- PropertyDescriptorGridEntry.cs
- TextTreeNode.cs
- TTSVoice.cs
- EditorPartCollection.cs
- TraceContextRecord.cs
- XmlTextReaderImpl.cs
- Pen.cs
- ArrayMergeHelper.cs
- RegexParser.cs
- MethodAccessException.cs
- ColorMatrix.cs
- MostlySingletonList.cs
- EventLogInternal.cs
- GroupJoinQueryOperator.cs
- UndirectedGraph.cs
- StringArrayConverter.cs