' page var
Private WithEvents mspellChecker As XamSpellChecker
' page load event
Dim spellBinding As New Binding() spellBinding.Mode = BindingMode.TwoWay Dim propPathSpellBinding As New PropertyPath("Text") spellBinding.Path = propPathSpellBinding spellBinding.Source = Me.narrative mspellChecker = New XamSpellChecker() mspellChecker.DictionaryUri = New Uri("Dictionaries/english-generic-whole.dict", UriKind.Relative) mspellChecker.SpellCheckTargets.Add(spellBinding) Me.LayoutRoot.Children.Add(mspellChecker) ' button click event Private Sub btnSpellCheck_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnSpellCheck.Click Try mspellChecker.SpellCheckDialog.StartupPosition = StartupPosition.Manual mspellChecker.SpellCheckDialog.Top = 50 mspellChecker.SpellCheckDialog.Left = 50 mspellChecker.SpellCheck() Catch ex As Exception ErrorHandler(ex) End Try End Sub the dictionaries are in teh clientbin folder on the website with the xap file clientbin dictionaries xxxxx.xap
Dim spellBinding As New Binding() spellBinding.Mode = BindingMode.TwoWay Dim propPathSpellBinding As New PropertyPath("Text") spellBinding.Path = propPathSpellBinding spellBinding.Source = Me.narrative mspellChecker = New XamSpellChecker() mspellChecker.DictionaryUri = New Uri("Dictionaries/english-generic-whole.dict", UriKind.Relative) mspellChecker.SpellCheckTargets.Add(spellBinding) Me.LayoutRoot.Children.Add(mspellChecker)
' button click event
Private Sub btnSpellCheck_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnSpellCheck.Click Try mspellChecker.SpellCheckDialog.StartupPosition = StartupPosition.Manual mspellChecker.SpellCheckDialog.Top = 50 mspellChecker.SpellCheckDialog.Left = 50 mspellChecker.SpellCheck() Catch ex As Exception ErrorHandler(ex) End Try End Sub the dictionaries are in teh clientbin folder on the website with the xap file clientbin dictionaries xxxxx.xap
Private Sub btnSpellCheck_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnSpellCheck.Click Try mspellChecker.SpellCheckDialog.StartupPosition = StartupPosition.Manual mspellChecker.SpellCheckDialog.Top = 50 mspellChecker.SpellCheckDialog.Left = 50 mspellChecker.SpellCheck() Catch ex As Exception ErrorHandler(ex) End Try End Sub
the dictionaries are in teh clientbin folder on the website with the xap file
clientbin
dictionaries
xxxxx.xap
Hi,
this is most probably an issue with downloading the dictionaries. You could add an event handler to DictionaryDownloadCompleted event and check the e.Error argument to see if something's wrong with downloading the dictionary.
Hope this helps,
HI,
I am following up on this forum thread, please let me know if you require further assistance.
Sincerely Matt Developer Support Engineer
I did as suggested and captured the error but all i got was "The remote server returned an error: NotFound."
My dictionary file is in the clientbin folder of my aspx web app.
Here is my spellchecker xaml.
<ig:XamSpellChecker x:Name="simpleSpellChecker"
Visibility="Visible"
DictionaryUri="Dictionaries/us-english-v2-whole.dict"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ig:XamSpellChecker.DialogSettings>
<ig:XamSpellCheckerDialogSettings
SpellCheckDialogStyle="{StaticResource SpellcheckDialog}" />
</ig:XamSpellChecker.DialogSettings>
<ig:XamSpellChecker.SpellCheckTargets>
<Binding ElementName="txtSpell" Path="Text" Mode="TwoWay" />
</ig:XamSpellChecker.SpellCheckTargets>
</ig:XamSpellChecker>
The error message indicates that the dictionary is not found in the given location. Could you check which is the home directory for your web site and verify the relative path to the dictionary is correct ?
Another thing you could try is to enter the path to the dictionary directly in the browser and see if it can be accessed. It should be something like "http://localhost:port/Dictionaries/us-english-v2-whole.dict".
I don't think you need something special to get this working.
Actually, I tried to reproduce your scenario by hosting the spellchecker on IIS web site on my local machine. When I used an absolute uri for the dictionary (http://localhost:8080/Dictionaries/xxx.dict). I had to add a MIME type for the .dict files extension in order to get this working. However, using relative uri (as you do in your code) worked without the need to add a mime type.
One easy workaround if you only use the english dictionary would be not to specify a dictionary uri at all. The spell-checker automatically uses the english dictionary if you do not explicitly set your own dictionary uri.
If this does not work for you, you could try using an absolute path to the dictionary (e.g., http://site.address:port/Dictionaries/dictionary.dict) and see if it's working. You might need to add a mime type for the .dict file extension (text/plain should be fine). You could also enable directory browsing for your web site and test browsing the Dictionaries folder in the browser to make sure the absolute uri you're using is valid. If it's working with absolute Uri's, it should also work with relative Uri's.
When I created my Silverlight App I also created a ASPX App as well. When deploying I use VS's "Publish" option and delpoy to file system (sense I have remote access to the server and the wwwroot directory where the app will be published to is shared to me) then I manually copy the dictionary directory which contains all the dictionary files to the ClientBin where my xap file is. Am I doing something wrong?? Is there something extra that I must do in IIS on the dev server? Install mime types, handlers??
Any help would be appreciated.
the path to the .dict file should be relative to your Silverlight Application .xap file. In Dev environment, you place the dictionaries in your ClientBin folder because this is where the .xap file is being deployed when you build your solution.
When you deploy your .xap file on an IIS web site, you need to place the .dict files in such a way so the relative path is the same. So, you'll need to create a "Dictionaries" subfolder in the location where your .xap file is stored on the IIS server and place the dictionaries there.
What you suggest is what I currently have (as stated in my reply) and it's still not working.
Create a directory in your ClientBin and place the dictionary in this directory. Here is a help link http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=SL_xamSpellChecker_Dictionaries.html
Sincerely, Matt Developer Support Engineer