Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- WindowsListViewSubItem.cs
- Application.cs
- FrameworkContentElementAutomationPeer.cs
- DecoderBestFitFallback.cs
- SafeTimerHandle.cs
- AppDomainAttributes.cs
- TriState.cs
- FlowDocumentFormatter.cs
- WebRequestModuleElementCollection.cs
- PageThemeParser.cs
- StringUtil.cs
- Baml2006KnownTypes.cs
- TransactionProtocolConverter.cs
- SecurityTokenContainer.cs
- PathSegmentCollection.cs
- Clipboard.cs
- OdbcFactory.cs
- unsafenativemethodstextservices.cs
- WebPartCatalogAddVerb.cs
- Win32.cs
- IdentityModelStringsVersion1.cs
- ObjectDataSourceEventArgs.cs
- PeerIPHelper.cs
- DataControlFieldHeaderCell.cs
- AttachedAnnotationChangedEventArgs.cs
- ToggleButton.cs
- PropertyGroupDescription.cs
- SmuggledIUnknown.cs
- AspCompat.cs
- ThicknessAnimationBase.cs
- RegexBoyerMoore.cs
- DecimalConstantAttribute.cs
- PasswordTextContainer.cs
- EntityStoreSchemaGenerator.cs
- DSASignatureDeformatter.cs
- TextEndOfSegment.cs
- TcpWorkerProcess.cs
- HttpResponseHeader.cs
- EditingScope.cs
- AlignmentXValidation.cs
- followingsibling.cs
- CounterSetInstanceCounterDataSet.cs
- DataServiceRequestOfT.cs
- FontStretch.cs
- AsnEncodedData.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- SessionStateUtil.cs
- FragmentNavigationEventArgs.cs
- MetafileHeaderEmf.cs
- ScrollBar.cs
- WhitespaceRule.cs
- UnorderedHashRepartitionStream.cs
- AttributeEmitter.cs
- ActivityAction.cs
- FileDetails.cs
- Utilities.cs
- HierarchicalDataSourceDesigner.cs
- TextElementEnumerator.cs
- FileLevelControlBuilderAttribute.cs
- MetadataItem.cs
- Ref.cs
- ParallelTimeline.cs
- TogglePatternIdentifiers.cs
- parserscommon.cs
- TerminatingOperationBehavior.cs
- ADConnectionHelper.cs
- WebPartMenuStyle.cs
- WindowsListViewGroup.cs
- XmlDesignerDataSourceView.cs
- Utils.cs
- IdentifierService.cs
- SignatureToken.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- WebPartExportVerb.cs
- ObjectFullSpanRewriter.cs
- HttpResponseInternalWrapper.cs
- JapaneseCalendar.cs
- QuaternionRotation3D.cs
- GPRECTF.cs
- UrlPropertyAttribute.cs
- WindowVisualStateTracker.cs
- FormViewInsertEventArgs.cs
- ScrollableControl.cs
- ConfigXmlAttribute.cs
- LinearGradientBrush.cs
- DispatcherSynchronizationContext.cs
- MimeBasePart.cs
- NetSectionGroup.cs
- ToolStripItemImageRenderEventArgs.cs
- ResourceReferenceExpressionConverter.cs
- RelationshipEndMember.cs
- ChoiceConverter.cs
- MembershipValidatePasswordEventArgs.cs
- SHA256Managed.cs
- StoryFragments.cs
- ErrorInfoXmlDocument.cs
- StorageInfo.cs
- XmlNamespaceMappingCollection.cs
- CacheDependency.cs
- ModelTreeEnumerator.cs