ARTICLE

WPF Spell Checker in VB.NET

Posted by Micalgray Articles | XAML in VB.NET February 22, 2011
Here we see how to use spell checker to check our content and also display all its suggestion text.
Download Files:
 
Reader Level:

Here we see how to use spell checker to check our content and also display all its suggestion text.

Spell checker

The spell checker is used to check spelling of our content in XAML, or The Spell checker returns you all its suggestions for your text.

Now creating a TextBlock control and RichTextBox control in XAML.

XAML code

<TextBlock Height="23" HorizontalAlignment="Left" Margin="0,23,0,0" Name="TextBlock1" Text="Enter content:" VerticalAlignment="Top" Width="141" FontSize="18" Foreground="LawnGreen" />

        <RichTextBox Height="100" HorizontalAlignment="Left" Margin="0,44,0,0" Name="RichTextBox1" VerticalAlignment="Top" Width="200" Background="DodgerBlue" FontSize="18" />

For example

Now creating TextBlock and RichTextBox control in XAML. The XAML code represents as following.

XAML code

<Window x:Class="MainWindow"

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

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

    Title="MainWindow" Height="350" Width="525">

    <Grid>

        <TextBlock Height="23" HorizontalAlignment="Left" Margin="0,23,0,0" Name="TextBlock1" Text="Enter content:" VerticalAlignment="Top" Width="141" FontSize="18" Foreground="LawnGreen" />

 

        <RichTextBox Height="100" HorizontalAlignment="Left" Margin="0,44,0,0" Name="RichTextBox1" VerticalAlignment="Top" Width="200" Background="LightSalmon" FontSize="18" />

    </Grid>

</Window>

 

sp2.gif

Figure1.gif

 

Now double click on the RichTextBox and add the following code.

 

Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs) Handles RichTextBox1.TextChanged

        SpellCheck.SetIsEnabled(RichTextBox1, True)

        SpellCheck.SetSpellingReform(RichTextBox1, SpellingReform.PreAndPostreform)

    End Sub

 

Now run the application and test it.

sp1.gif

Figure2.gif

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
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