This is a migrated thread and some comments may be shown as answers.

SpellCheckingWindowsStyle Example

2 Answers 80 Views
SpellChecker
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 18 Feb 2014, 02:48 PM

Is there an example of setting the SpellCheckingWindowsStyle  for the RadSpellChecker?  Im using example in another thread of spell checking multiple text boxes..  My code is as follows - Im just not sure how to style the spell checker and what properties are available. Can I have an example?

 

public partial class MainPage : UserControl
{
    public MainPage()
    {
        InitializeComponent();
        RadSpellChecker.SpellCheckingCompleted += spellCheckingCompleted;
 
        textBoxes = new List<TextBox>();
        textBoxes.Add(this.textBox1);
        textBoxes.Add(this.textBox2);
        textBoxes.Add(this.textBox3);
    }
 
    int i;
    List<TextBox> textBoxes;
 
    private void button1_Click(object sender, RoutedEventArgs e)
    {
        RadSpellChecker.WindowSettings.ShowAlertWhenSpellCheckingCompleted = false;
        RadSpellChecker.Check(this.textBox1, SpellCheckingMode.AllAtOnce);
    }
 
    private void spellCheckingCompleted(object sender, SpellCheckingCompletedEventArgs args)
    {
        if (i == 2)
        {
            i = 0;
            return;
        }
 
        i++;
        RadSpellChecker.Check(this.textBoxes[i], SpellCheckingMode.AllAtOnce);
 
    }
}

2 Answers, 1 is accepted

Sort by
0
Tony
Top achievements
Rank 1
answered on 18 Feb 2014, 05:36 PM
More specifically, I really need to set the foreground color for the textbox containing "Not in Dictionary". (Im using the No-Xaml libraries).  In my app.xaml, I set a global color for text boxes to be:


 <Style TargetType="TextBlock" BasedOn="{StaticResource TextBaseStyle}">
<Setter Property="Foreground" Value="White" />
</Style>

The issue is that the text the labels and text for "not in dictionary" are white.  How can I customize this to be black using the SpellCheckingWindowsStyle?
0
Todor
Telerik team
answered on 21 Feb 2014, 09:52 AM
Hello Tony,

Thank you for contacting us.

Unfortunately, there isn't a way to apply different styles for the same controls in the RadSpellChecker. This means that every control of a given type will have the same style inside the control. 

If you want to style the TextBox control you can base your own style on the 'TextBoxStyle' which is provided by us and is placed in System.Windows.xaml file. This file is a resource dictionary which contains styles for some of the native MS controls. Here you can find the full list of styled controls.

Anyway, the TextBox on which you want to change the Foreground property is in ReadOnly state, but unfortunately even you set that property in its Template's VisualState on the element in the control template which is responsible for displaying the text, the internal MS control TextBoxView is not updated. It gets only the TextBox's Foreground property value which is set through the style setter or locally. This is a limitation of the TextBox control.

I hope this information will be helpful.
If you need further assistance, please contact us again.


Regards,
Todor
Telerik
Tags
SpellChecker
Asked by
Tony
Top achievements
Rank 1
Answers by
Tony
Top achievements
Rank 1
Todor
Telerik team
Share this question
or