Completed
Last Updated: 20 Oct 2015 11:41 by ADMIN
ADMIN
Hristo
Created on: 08 Sep 2015 13:24
Category: RichTextEditor
Type: Bug Report
0
FIX. RadRichTextEditor - Change and ChangeAll buttons in a SpellCheckingDialog are enabled even though the list control with the suggestions is empty.
Workaround:

public partial class Form1 : Form
{
    private Telerik.WinForms.RichTextEditor.RichTextBoxUI.Dialogs.SpellCheckingDialog spellDlg;

    public Form1()
    {
        InitializeComponent();
    }

    private void radButton1_Click(object sender, EventArgs e)
    {
        this.spellDlg = new Telerik.WinForms.RichTextEditor.RichTextBoxUI.Dialogs.SpellCheckingDialog();
        Telerik.WinForms.Documents.UI.Extensibility.SpellCheckingUIManager manager = new Telerik.WinForms.Documents.UI.Extensibility.SpellCheckingUIManager(this.radRichTextEditor1.RichTextBoxElement);

        FieldInfo fi = this.spellDlg.GetType().GetField("suggestionsListBox", BindingFlags.NonPublic | BindingFlags.Instance);
        RadListControl suggestionListBox = fi.GetValue(this.spellDlg) as RadListControl;

        suggestionListBox.DataBindingComplete -= suggestionListBox_DataBindingComplete;
        suggestionListBox.DataBindingComplete += suggestionListBox_DataBindingComplete;
        this.spellDlg.ShowDialog(manager, this.radRichTextEditor1.RichTextBoxElement);
    }

    private void suggestionListBox_DataBindingComplete(object sender, ListBindingCompleteEventArgs e)
    {
        if (((RadListControl)sender).Items.Count == 0)
        {
            FieldInfo fiBtnChange = this.spellDlg.GetType().GetField("buttonChange", BindingFlags.NonPublic | BindingFlags.Instance);
            RadButton btnChange = fiBtnChange.GetValue(this.spellDlg) as RadButton;
            btnChange.Enabled = false;

            FieldInfo fiBtnChangeAll = this.spellDlg.GetType().GetField("buttonChangeAll", BindingFlags.NonPublic | BindingFlags.Instance);
            RadButton btnChangeAll = fiBtnChangeAll.GetValue(this.spellDlg) as RadButton;
            btnChangeAll.Enabled = false;
        }
    }
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments