ARTICLE

The Spell Checker use in WPF application

Posted by Sapna Malik Articles | WPF using VB.NET August 30, 2010
Tags: .NET, ASP.NET, WPF, VB.NET
In this article, We will see how to use spell checker in WPF application.
Download Files:
 
Reader Level:

The Spell Checker functionality is very useful. In this article, We will see how to use spell checker in WPF application. This functionality use for check spelling all type in English.  I have explored the SpellCheck functionality of WPF TextBoxBase object.

We will set SpellCheck.IsEnabled="True" property in the textbox after that automatically derive the Spell Checking functionality.

 

This code is .xaml:-

 

<Window x:Class="Window1"

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

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

    Title="Window1" Height="300" Width="300">

    <Grid>

        <Grid.RowDefinitions>

            <RowDefinition Height="30"></RowDefinition>

            <RowDefinition Height="100"></RowDefinition>                      

        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="30"></ColumnDefinition>

            <ColumnDefinition Width="75"></ColumnDefinition>

            <ColumnDefinition Width="150"></ColumnDefinition>

            <ColumnDefinition Width="30"></ColumnDefinition>

        </Grid.ColumnDefinitions>

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

        <TextBlock x:Name="txtSpellMessage" FontSize="15" Text="Comment:" Margin="0,32,0,0"></TextBlock>

         </Grid>

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

             <TextBox x:Name="txtSpellCheck" FontSize="15" SpellCheck.IsEnabled="True"
AcceptsReturn="True" Width="175" Height="150"></TextBox>

        </Grid>

    </Grid>

</Window>

 

After run the application we will see  the TextBox txtSpellCheck, have SpellChecker enabled. We type wrong spelling in the textbox automatically detect misspelled words and will put an red underline on the word.

 

We can easily spelling check in this application throw. 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.

 

Output:-

 

 checker1.bmp

 


share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor