ARTICLE

Spell Checker in WPF using VB.NET

Posted by Rahul Kumar Saxena Articles | WPF using VB.NET July 13, 2010
In this article I am going to show how we can check our word spelling in WPF.
 
Reader Level:

In this article, I am going to show how we can check spelling of our content in wpf application. For doing this WPF have SpellCheck feature. SpellCheck is added to TextBoxBase object mean if we set SpellCheck.IsEnabled="True" property of our text box then this textbox automatically derive the Spell Checking functionality

This is xaml code

<Window x:Class="SpellCheckerInWPF.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        Title="Spell Check in WPF" Height="350" Width="525">

    <Grid>

        <Grid.RowDefinitions>

            <RowDefinition Height="20"></RowDefinition>

            <RowDefinition Height="20"></RowDefinition>

            <RowDefinition Height="20"></RowDefinition>

            <RowDefinition Height="Auto"></RowDefinition>

            <RowDefinition Height="20"></RowDefinition>

        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="20"></ColumnDefinition>

            <ColumnDefinition Width="100"></ColumnDefinition>

            <ColumnDefinition Width="200"></ColumnDefinition>

            <ColumnDefinition Width="Auto"></ColumnDefinition>

            <ColumnDefinition Width="20"></ColumnDefinition>

        </Grid.ColumnDefinitions>

        <Grid Grid.Row="1" Grid.Column="1">

            <TextBlock x:Name="txtBlckSpellMessage" Text="Comment:"></TextBlock>

        </Grid>

        <Grid Grid.Row="1" Grid.Column="2">

            <TextBox x:Name="txtSpellCheck" SpellCheck.IsEnabled="True" AcceptsReturn="True" Width="200"></TextBox>

        </Grid>

    </Grid>

</Window>

When we run the application and if we type wrong spelling then the text will have red underline indicating that it is wrong spelling. If we right click on this word then a list of words is shown. We can select the correct word from the list available with us. Working of spell checker is shown in the below figure.

SpellCheckerInWPF.JPG

Figure 1.

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Become a Sponsor