Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
595
Setting Dictionary Uri
posted

I want to set my own .dict file to the spell checker but it doesn't seem to want to take it.  For the sake of testing I've copied over the english-generic-whole.dict file from installed Infragistics silverlight directory and put it into a folder called Dictionaries within my project.  I've tried assigning the dictionary file to the "DictionaryUri" but when ran and invoking the spell check a popup message popups up stating that it is loading the dictionary file the disappaires as fast as it showed up.  Then I tried setting the "UserDictionaryUri" to the file but nothing happens when invoking the spell checker. 

Setup:

I've created a new silverlight project using web application to host the silverlight app.  In the silverlight app there are the default directories that it creates when creating a new project.  I've added the "Dictionaries" folder into the project.  In that folder I've copied over the "english-generic-whole.dict" dictionary file from "C:\Program Files (x86)\Infragistics\NetAdvantage for .NET 2009.1\Silverlight\Dictionaries" (Vista 64-bit).  Below is my xaml and code behind code for the MainPage.xaml that I used to test.

XAML:

<UserControl x:Class="SpellChecker.MainPage"
 xmlns:igSpell="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.XamWebSpellChecker.v9.1"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 mc:Ignorable="d"
 d:DesignWidth="640"
 d:DesignHeight="480">
 <Grid x:Name="LayoutRoot">
  <StackPanel>
   <Button x:Name="RunSpellCheck" Content="Button" Click="RunSpellCheck_Click"/>
   <TextBox x:Name="txtValue" Text="TextBox" TextWrapping="Wrap" Margin="0" d:LayoutOverrides="Width"/>
   <igSpell:XamWebSpellChecker x:Name="ucSpellChecker" Margin="0" DictionaryUri="Dictionaries/english-generic-whole.dict">
    <igSpell:XamWebSpellChecker.SpellCheckTargets>
     <Binding ElementName="txtValue" Path="Text" Mode="TwoWay" />
    </igSpell:XamWebSpellChecker.SpellCheckTargets>
   </igSpell:XamWebSpellChecker>
  </StackPanel>
 </Grid>
</UserControl>

Code Behind:

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SpellChecker
{
 public partial class MainPage : UserControl
 {
  public MainPage()
  {
   // Required to initialize variables
   InitializeComponent();
  }

  private void RunSpellCheck_Click(object sender, System.Windows.RoutedEventArgs e)
  {
   ucSpellChecker.SpellCheck();
  }
 }
}

Parents
No Data
Reply
  • 6475
    Verified Answer
    posted

    Hi,

       My first guess would be that the dictionary is not found on the specified location. You could handle the DictionaryDownloadCompleted event and see if there's an error downloading the dictionary. You could verify it by checking the e.Error event argument.

      Where is your .dict file stored? Looking at your XAML, it should be in Dictionaries folder, located in WebServer's ClientBin folder. Is that your case?

    Hope that helps,

Children