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:
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
Hello Kimberly,
I can suggest you see this forum thread:
http://es.infragistics.com/community/forums/p/19413/450475.aspx#450475
where a similar question is already discussed.
Turning this on for XAMTextEditor and I can get it to display the red line to show word misspelled but when I right click on the word I don't see the context menu that would come up in a WPF Text box to show suggestions. How do I get this to come up on XAMTextEditor? See image below.
Just an update:
Turns out this is a bug in WPF itself, not the XamDataGrid. It only happens with the UK locale though (am I the only person in the UK using WPF spell checking?!?!).
See this thread:
http://forums.msdn.microsoft.com/en/wpf/thread/ad49ca62-280c-4db4-9780-b277072dccb0/
Ah got it, I was assuming the dependency property had to be on the object I was styling, but I can set it on attached objects too:
textboxstyle.Setters.Add(new Setter(SpellCheck.IsEnabledProperty, true));
So I guess my spell-checking weirdness is something to do with the underlying string, not the xamdatagrid. hmmm.
Update: I've examined the string being shown. No weird characters. Also, cutting the text from the textbox, and pasting it right back in the same box, removes the red-underline! I've tried switching the grid to LazyLoad, but no difference...
I do need to do this programatically - I'm building by grid fields based on lots of db settings, so the styles have to be dynamicly constructed,
How can I style SpellCheck in C#?? Doing Style st = new Style(typeof(SpellCheck)) throws an exception!