This documentation is archived and is not being maintained.

SpellCheck.SetIsEnabled Method

Enables or disables spellchecking on the specified text editing control (i.e. TextBox or RichTextBox).

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public static void SetIsEnabled(
	TextBoxBase textBoxBase,
	bool value
)
You cannot use methods in XAML.

Parameters

textBoxBase
Type: System.Windows.Controls.Primitives.TextBoxBase

The text editing control (i.e. TextBox or RichTextBox) to enable or disable spellchecking on.

value
Type: System.Boolean

Boolean value that specifies whether spellchecking is enabled on the text editing control.

This method enables an attached property usage for the IsEnabled property in XAML. The XAML usage is illustrated in the example.

The following example shows how to enable real-time spell checking in a TextBox by using the IsEnabled property of the SpellCheck class.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <StackPanel>
    <TextBox SpellCheck.IsEnabled="True" Name="myTextBox"></TextBox>
  </StackPanel>

</Page>
using System;
using System.Windows;
using System.Windows.Controls;

namespace SDKSample
{
    public partial class SpellCheckExample : Page
    {
        public SpellCheckExample()
        {
            StackPanel myStackPanel = new StackPanel();

            //Create TextBox
            TextBox myTextBox = new TextBox();
            myTextBox.Width = 200;

            // Enable spellchecking on the TextBox.
            myTextBox.SpellCheck.IsEnabled = true;

            // Alternatively, the SetIsEnabled method could be used 
            // to enable or disable spell checking like this: 
            // SpellCheck.SetIsEnabled(myTextBox, true);

            myStackPanel.Children.Add(myTextBox);
            this.Content = myStackPanel;
        }
    }
}

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Show: