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
- SqlDependencyListener.cs
- filewebresponse.cs
- WinFormsComponentEditor.cs
- DynamicEndpoint.cs
- DefaultBinder.cs
- StylesEditorDialog.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- TransactionInterop.cs
- TypefaceMap.cs
- DataGridViewComboBoxCell.cs
- GridViewDeletedEventArgs.cs
- QilInvokeLateBound.cs
- Classification.cs
- mediaclock.cs
- MethodSet.cs
- DecodeHelper.cs
- COSERVERINFO.cs
- ZoomPercentageConverter.cs
- FormsAuthenticationUserCollection.cs
- SecondaryIndex.cs
- TemplateControlCodeDomTreeGenerator.cs
- GeometryModel3D.cs
- OperationResponse.cs
- SafeEventLogWriteHandle.cs
- CreateUserWizardDesigner.cs
- ComNativeDescriptor.cs
- ListViewPagedDataSource.cs
- StylusPointProperty.cs
- EditingScope.cs
- JoinGraph.cs
- Win32.cs
- PackUriHelper.cs
- DelegatingTypeDescriptionProvider.cs
- Compensate.cs
- TypefaceMap.cs
- ElementUtil.cs
- SpotLight.cs
- DataObjectCopyingEventArgs.cs
- CodeNamespaceImport.cs
- HttpCacheParams.cs
- XmlTextReaderImplHelpers.cs
- MatrixAnimationUsingPath.cs
- SystemIPInterfaceStatistics.cs
- TypefaceCollection.cs
- PageThemeBuildProvider.cs
- DataGridViewDataErrorEventArgs.cs
- BamlReader.cs
- StyleConverter.cs
- SqlPersistenceProviderFactory.cs
- StreamInfo.cs
- DeferredElementTreeState.cs
- StickyNoteHelper.cs
- NameScopePropertyAttribute.cs
- SelectionRange.cs
- InputLanguageManager.cs
- HttpListener.cs
- DateTimeEditor.cs
- DBBindings.cs
- COM2ExtendedUITypeEditor.cs
- SqlBulkCopy.cs
- AsyncOperationManager.cs
- CriticalFinalizerObject.cs
- OdbcConnectionString.cs
- TransactionFlowBindingElement.cs
- MaterialGroup.cs
- NativeRecognizer.cs
- Part.cs
- ConfigurationValidatorAttribute.cs
- CmsUtils.cs
- DetailsViewAutoFormat.cs
- _CommandStream.cs
- TextTrailingCharacterEllipsis.cs
- FocusChangedEventArgs.cs
- TextPointerBase.cs
- WindowsImpersonationContext.cs
- Scene3D.cs
- BindingList.cs
- TrustSection.cs
- TypeSystemHelpers.cs
- CalendarBlackoutDatesCollection.cs
- ConstructorBuilder.cs
- FontNameEditor.cs
- DataTableClearEvent.cs
- Exceptions.cs
- Rect.cs
- ViewGenResults.cs
- StackOverflowException.cs
- ColumnBinding.cs
- Operator.cs
- BamlBinaryReader.cs
- Rules.cs
- DiscoveryMessageSequence.cs
- InstanceView.cs
- ISessionStateStore.cs
- HostedImpersonationContext.cs
- HyperLinkStyle.cs
- TypedTableBase.cs
- CodeMemberProperty.cs
- ComAdminWrapper.cs
- SqlNamer.cs