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
990
Spell checking in grid text box
posted

I want to have spell checking (the red underlines) enabled for textboxes in my XamDataGrid. I'm building the styles manually in C#, like this:

 Style ret = new Style(typeof(TextBox));

ret.Setters.Add(new Setter(TextBox.AcceptsReturnProperty, true));

newstyle.Resources.Add(typeof(TextBox), ret);

 Then applying that style to the Field.Settings.EditorStyle

But SpellCheck is an attached property, so how can I do it?

Thanks

Parents
No Data
Reply
  • 990
    posted

    Ok I can almost get this working using an event handler:

    newstyle.Setters.Add(new EventSetter(XamTextEditor.EditModeStartedEvent, new EventHandler<EditModeStartedEventArgs>(SpellCheckEditStart)));

    And then..

    private static void SpellCheckEditStart(object sender, EditModeStartedEventArgs e)

    {

    TextBox b = (TextBox)VisualTreeWalker.FindFirst(typeof(TextBox), (System.Windows.Media.Visual)e.Source);b.SpellCheck.IsEnabled = true;

    }

     This appears to work BUT comes up with erronious spelling mistakes! Almost as if it isn't word-breaking correctly (ie 'work' is a spelling error. Right click and select 'work' as a correction, and it shows 'workk', 2 k's).

    Any ideas? Vol 2 hoxfix 1007

Children