Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Controls / SpellCheck.cs / 1 / SpellCheck.cs
//---------------------------------------------------------------------------- // // File: SpellCheck.cs // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: Speller properties for TextBoxBase. // //--------------------------------------------------------------------------- namespace System.Windows.Controls { using System.Threading; using System.Windows.Documents; using System.Windows.Controls.Primitives; ////// Speller properties for TextBoxBase. /// public sealed class SpellCheck { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Ctor. internal SpellCheck(TextBoxBase owner) { _owner = owner; } #endregion Constructors //------------------------------------------------------ // // Public Properties // //----------------------------------------------------- #region Public Properties ////// Enables and disables spell checking within the associated TextBoxBase. /// ////// Defaults to false. /// public bool IsEnabled { get { return (bool)_owner.GetValue(IsEnabledProperty); } set { _owner.SetValue(IsEnabledProperty, value); } } ////// Enables and disables spell checking within a TextBoxBase. /// public static void SetIsEnabled(TextBoxBase textBoxBase, bool value) { if (textBoxBase == null) { throw new ArgumentNullException("textBoxBase"); } textBoxBase.SetValue(IsEnabledProperty, value); } ////// Enables and disables spell checking within the associated TextBoxBase. /// ////// Defaults to false. /// public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached( "IsEnabled", typeof(bool), typeof(SpellCheck), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnIsEnabledChanged))); ////// The spelling reform mode for the associated TextBoxBase. /// ////// In languages with reformed spelling rules (such as German or French), /// this property specifies whether to apply old (prereform) or new /// (postreform) spelling rules to examined text. /// public SpellingReform SpellingReform { get { return (SpellingReform)_owner.GetValue(SpellingReformProperty); } set { _owner.SetValue(SpellingReformProperty, value); } } ////// Sets the spelling reform mode for a TextBoxBase. /// public static void SetSpellingReform(TextBoxBase textBoxBase, SpellingReform value) { if (textBoxBase == null) { throw new ArgumentNullException("textBoxBase"); } textBoxBase.SetValue(SpellingReformProperty, value); } ////// The spelling reform mode for the associated TextBoxBase. /// ////// In languages with reformed spelling rules (such as German or French), /// this property specifies whether to apply old (prereform) or new /// (postreform) spelling rules to examined text. /// public static readonly DependencyProperty SpellingReformProperty = DependencyProperty.RegisterAttached( "SpellingReform", typeof(SpellingReform), typeof(SpellCheck), new FrameworkPropertyMetadata(Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName == "de" ? SpellingReform.Postreform : SpellingReform.PreAndPostreform, new PropertyChangedCallback(OnSpellingReformChanged))); #endregion Public Properties //------------------------------------------------------ // // Private Methods // //------------------------------------------------------ #region Private Methods // Callback for changes to the IsEnabled property. private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TextBoxBase textBoxBase = d as TextBoxBase; if (textBoxBase != null) { TextEditor textEditor = TextEditor._GetTextEditor(textBoxBase); if (textEditor != null) { textEditor.SetSpellCheckEnabled((bool)e.NewValue); } } } // SpellingReformProperty change callback. private static void OnSpellingReformChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TextBoxBase textBoxBase = d as TextBoxBase; if (textBoxBase != null) { TextEditor textEditor = TextEditor._GetTextEditor(textBoxBase); if (textEditor != null) { textEditor.SetSpellingReform((SpellingReform)e.NewValue); } } } #endregion Private Methods //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ #region Private Fields // TextBoxBase mapped to this object. private readonly TextBoxBase _owner; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: SpellCheck.cs // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: Speller properties for TextBoxBase. // //--------------------------------------------------------------------------- namespace System.Windows.Controls { using System.Threading; using System.Windows.Documents; using System.Windows.Controls.Primitives; ////// Speller properties for TextBoxBase. /// public sealed class SpellCheck { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Ctor. internal SpellCheck(TextBoxBase owner) { _owner = owner; } #endregion Constructors //------------------------------------------------------ // // Public Properties // //----------------------------------------------------- #region Public Properties ////// Enables and disables spell checking within the associated TextBoxBase. /// ////// Defaults to false. /// public bool IsEnabled { get { return (bool)_owner.GetValue(IsEnabledProperty); } set { _owner.SetValue(IsEnabledProperty, value); } } ////// Enables and disables spell checking within a TextBoxBase. /// public static void SetIsEnabled(TextBoxBase textBoxBase, bool value) { if (textBoxBase == null) { throw new ArgumentNullException("textBoxBase"); } textBoxBase.SetValue(IsEnabledProperty, value); } ////// Enables and disables spell checking within the associated TextBoxBase. /// ////// Defaults to false. /// public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached( "IsEnabled", typeof(bool), typeof(SpellCheck), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnIsEnabledChanged))); ////// The spelling reform mode for the associated TextBoxBase. /// ////// In languages with reformed spelling rules (such as German or French), /// this property specifies whether to apply old (prereform) or new /// (postreform) spelling rules to examined text. /// public SpellingReform SpellingReform { get { return (SpellingReform)_owner.GetValue(SpellingReformProperty); } set { _owner.SetValue(SpellingReformProperty, value); } } ////// Sets the spelling reform mode for a TextBoxBase. /// public static void SetSpellingReform(TextBoxBase textBoxBase, SpellingReform value) { if (textBoxBase == null) { throw new ArgumentNullException("textBoxBase"); } textBoxBase.SetValue(SpellingReformProperty, value); } ////// The spelling reform mode for the associated TextBoxBase. /// ////// In languages with reformed spelling rules (such as German or French), /// this property specifies whether to apply old (prereform) or new /// (postreform) spelling rules to examined text. /// public static readonly DependencyProperty SpellingReformProperty = DependencyProperty.RegisterAttached( "SpellingReform", typeof(SpellingReform), typeof(SpellCheck), new FrameworkPropertyMetadata(Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName == "de" ? SpellingReform.Postreform : SpellingReform.PreAndPostreform, new PropertyChangedCallback(OnSpellingReformChanged))); #endregion Public Properties //------------------------------------------------------ // // Private Methods // //------------------------------------------------------ #region Private Methods // Callback for changes to the IsEnabled property. private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TextBoxBase textBoxBase = d as TextBoxBase; if (textBoxBase != null) { TextEditor textEditor = TextEditor._GetTextEditor(textBoxBase); if (textEditor != null) { textEditor.SetSpellCheckEnabled((bool)e.NewValue); } } } // SpellingReformProperty change callback. private static void OnSpellingReformChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TextBoxBase textBoxBase = d as TextBoxBase; if (textBoxBase != null) { TextEditor textEditor = TextEditor._GetTextEditor(textBoxBase); if (textEditor != null) { textEditor.SetSpellingReform((SpellingReform)e.NewValue); } } } #endregion Private Methods //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ #region Private Fields // TextBoxBase mapped to this object. private readonly TextBoxBase _owner; #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
- _NativeSSPI.cs
- DbConnectionClosed.cs
- UnSafeCharBuffer.cs
- UserControlParser.cs
- MaskedTextProvider.cs
- DependencyPropertyHelper.cs
- XmlValueConverter.cs
- DataGridBeginningEditEventArgs.cs
- Encoder.cs
- BitmapEffectInput.cs
- PackageRelationship.cs
- OrderByExpression.cs
- ToggleButton.cs
- UserControlBuildProvider.cs
- ResizeGrip.cs
- SequenceDesignerAccessibleObject.cs
- UnsafeNativeMethods.cs
- SafeTimerHandle.cs
- DocumentViewerAutomationPeer.cs
- AnimationTimeline.cs
- WebContext.cs
- ScrollBarRenderer.cs
- FormsAuthenticationTicket.cs
- HttpTransportSecurity.cs
- SchemeSettingElement.cs
- XmlChildEnumerator.cs
- XmlEncodedRawTextWriter.cs
- IteratorAsyncResult.cs
- printdlgexmarshaler.cs
- ProcessModelSection.cs
- ExecutionContext.cs
- DesignTimeData.cs
- EventManager.cs
- RegexTree.cs
- SessionStateUtil.cs
- SelectionEditor.cs
- DesignerCapabilities.cs
- WinEventWrap.cs
- odbcmetadatacolumnnames.cs
- LinearGradientBrush.cs
- TimeSpanStorage.cs
- LabelEditEvent.cs
- DataGridViewCellStyle.cs
- ResXResourceSet.cs
- HighlightComponent.cs
- EnumDataContract.cs
- UnicodeEncoding.cs
- EventDescriptor.cs
- ControllableStoryboardAction.cs
- AxHost.cs
- ComplexType.cs
- InstanceDescriptor.cs
- GeometryDrawing.cs
- NegationPusher.cs
- TreeNodeStyleCollection.cs
- D3DImage.cs
- ExpressionPrinter.cs
- Bold.cs
- WebPartMenuStyle.cs
- CompilerTypeWithParams.cs
- CharUnicodeInfo.cs
- ProxyHelper.cs
- TrailingSpaceComparer.cs
- SAPICategories.cs
- FreezableOperations.cs
- SmtpDigestAuthenticationModule.cs
- PermissionSetTriple.cs
- ResourcesGenerator.cs
- StyleTypedPropertyAttribute.cs
- ExtentKey.cs
- CodePageEncoding.cs
- SqlGatherProducedAliases.cs
- TemplateControlCodeDomTreeGenerator.cs
- StringUtil.cs
- CodeVariableDeclarationStatement.cs
- WebPartVerbsEventArgs.cs
- ManagementInstaller.cs
- BinaryObjectInfo.cs
- LinearGradientBrush.cs
- PropertyEmitterBase.cs
- TimeSpanValidator.cs
- ContainerAction.cs
- SafeNativeMethods.cs
- WCFBuildProvider.cs
- InputProviderSite.cs
- ActiveXMessageFormatter.cs
- BoolExpr.cs
- cookiecontainer.cs
- ContextMenuStrip.cs
- StatusBarAutomationPeer.cs
- ColorMatrix.cs
- FloaterBaseParaClient.cs
- InternalUserCancelledException.cs
- EventMappingSettings.cs
- MailAddress.cs
- XmlLoader.cs
- EnumValidator.cs
- WindowsFormsSynchronizationContext.cs
- UnconditionalPolicy.cs
- SystemBrushes.cs