Hi,
I am trying to use XamSpellChecker in a popup with a textbox as its spell check target as shown below:
<ig:XamSpellChecker x:Name="igSpellChecker" MaxHeight="20"> <ig:XamSpellChecker.SpellCheckTargets> <Binding ElementName="NarrativeTextBox" Path="Text" Mode="TwoWay"/> </ig:XamSpellChecker.SpellCheckTargets> </ig:XamSpellChecker> <TextBox x:Name="NarrativeTextBox" Grid.Row="0" Grid.Column="1" Text="{Binding displayValue,Mode=TwoWay}" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Width="300" AcceptsReturn="True" FontFamily="{StaticResource BaseFont_Family}" FontSize="{StaticResource BaseFont_Size}" > <TextBox.Foreground> <SolidColorBrush Color="{StaticResource Black}"/> </TextBox.Foreground> </TextBox>
And when the SpellCheck method is called, a null-reference exception is thrown by the method. When I wrote a test application with just a popup with a text box and the spell checker, it worked fine. But as a part of a bigger application, a null reference exception is thrown. Any idea what might have made it throw that exception?
I tried to reproduce your issue, but without avail. I don't see any problems in the code you provided. Could you provide some more details - exception stack trace, etc ?
Regards,
Hi Georgi,
As I mentioned, the code worked fine in a separate application with just the popup. But when it is made a part of a bigger application, I had this problem :(
Here are the exception details:
Message: "Object reference not set to an instance of an object."
StackTrace: at Infragistics.Controls.Interactions.XamSpellChecker.SpellCheck() at LimitEnquiry.Modules.NarrativePopupViewModel.OnSpellCheck(Object o) at Microsoft.Practices.Prism.Commands.DelegateCommand`1.<>c__DisplayClass6.<.ctor>b__2(Object o) at Microsoft.Practices.Prism.Commands.DelegateCommandBase.Execute(Object parameter) at Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.Execute(Object parameter) at Microsoft.Practices.Prism.Commands.CommandBehaviorBase`1.ExecuteCommand() at Microsoft.Practices.Prism.Commands.ButtonBaseClickCommandBehavior.OnClick(Object sender, RoutedEventArgs e) at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)