Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- MenuBindingsEditorForm.cs
- HttpCachePolicyElement.cs
- ReflectionPermission.cs
- SynchronizationFilter.cs
- SearchForVirtualItemEventArgs.cs
- HttpClientProtocol.cs
- HScrollBar.cs
- SystemTcpConnection.cs
- CodeIterationStatement.cs
- VBIdentifierNameEditor.cs
- FillRuleValidation.cs
- HostingEnvironmentSection.cs
- ButtonChrome.cs
- SqlGenerator.cs
- SecurityTokenSpecification.cs
- SchemaTableOptionalColumn.cs
- ResourcePermissionBaseEntry.cs
- ToolBarTray.cs
- TreeBuilder.cs
- NativeMethods.cs
- MsdtcClusterUtils.cs
- IPipelineRuntime.cs
- StyleSheetComponentEditor.cs
- TranslateTransform3D.cs
- SrgsRule.cs
- RootDesignerSerializerAttribute.cs
- ISAPIRuntime.cs
- TableLayoutPanelResizeGlyph.cs
- MimePart.cs
- OrderedHashRepartitionStream.cs
- TraversalRequest.cs
- ControlBindingsCollection.cs
- OutputCacheProfile.cs
- FileReader.cs
- CaretElement.cs
- PartialArray.cs
- HebrewCalendar.cs
- WebPartManagerInternals.cs
- JsonServiceDocumentSerializer.cs
- EntityCollectionChangedParams.cs
- SynchronizationContext.cs
- DocumentViewerHelper.cs
- InfoCardKeyedHashAlgorithm.cs
- PathFigureCollectionConverter.cs
- DragDrop.cs
- GridItemProviderWrapper.cs
- XmlQueryOutput.cs
- XmlMembersMapping.cs
- SuppressMergeCheckAttribute.cs
- EntityTransaction.cs
- QuestionEventArgs.cs
- MasterPageParser.cs
- StorageBasedPackageProperties.cs
- SafeRightsManagementQueryHandle.cs
- FontWeights.cs
- SQLResource.cs
- ValueType.cs
- ZoneMembershipCondition.cs
- Figure.cs
- MetabaseServerConfig.cs
- NativeMethods.cs
- ObfuscateAssemblyAttribute.cs
- DefaultHttpHandler.cs
- DataControlFieldCollection.cs
- WebPartUtil.cs
- CultureSpecificStringDictionary.cs
- HtmlLink.cs
- FormViewModeEventArgs.cs
- MetadataExchangeClient.cs
- ResourceReferenceExpression.cs
- InvalidProgramException.cs
- UnaryExpression.cs
- LogEntrySerializer.cs
- AdditionalEntityFunctions.cs
- PreservationFileWriter.cs
- ColumnResizeAdorner.cs
- TabPageDesigner.cs
- counter.cs
- BinaryExpression.cs
- GridViewCancelEditEventArgs.cs
- safelinkcollection.cs
- DiscoveryDocumentSearchPattern.cs
- TypeValidationEventArgs.cs
- WebSysDisplayNameAttribute.cs
- complextypematerializer.cs
- TextShapeableCharacters.cs
- RuntimeVariableList.cs
- SmtpSection.cs
- XmlHierarchicalDataSourceView.cs
- PointKeyFrameCollection.cs
- StopStoryboard.cs
- UrlPropertyAttribute.cs
- LinqDataSource.cs
- ForceCopyBuildProvider.cs
- ViewRendering.cs
- StorageTypeMapping.cs
- ContentElement.cs
- UserControlDocumentDesigner.cs
- InkCanvasSelection.cs
- FormViewUpdatedEventArgs.cs