How to reproduce:
public partial class Form1 : Form
{
RadRichTextBox tb1;
RadRichTextBox tb2;
private bool shouldFocus = false;
public Form1()
{
InitializeComponent();
tb1 = new RadRichTextBox();
this.Controls.Add(tb1);
tb2 = new RadRichTextBox();
tb2.Location = new Point(200, 0);
this.Controls.Add(tb2);
this.Load += Form1_Load;
}
private void Form1_Load(object sender, EventArgs e)
{
StyleDefinition style = new StyleDefinition();
tb1.IsReadOnly = true;
tb1.Document.Insert("text 1", style);
tb2.Document.Insert("text 2", style);
tb2.IsReadOnly = true;
}
private void radButton1_Click(object sender, EventArgs e)
{
tb1.IsReadOnly = false;
tb2.IsReadOnly = false;
tb1.Focus();
}
}
Workaround:
public partial class Form1 : Form
{
RadRichTextBox tb1;
RadRichTextBox tb2;
private bool shouldFocus = false;
public Form1()
{
InitializeComponent();
tb1 = new RadRichTextBox();
tb1.GotFocus += tb1_GotFocus;
tb1.LostFocus += tb1_LostFocus;
this.Controls.Add(tb1);
tb2 = new RadRichTextBox();
tb2.Location = new Point(200, 0);
tb2.GotFocus += tb2_GotFocus;
tb2.LostFocus += tb2_LostFocus;
this.Controls.Add(tb2);
this.Load += Form1_Load;
}
private void tb2_LostFocus(object sender, EventArgs e)
{
shouldFocus = false;
tb2.IsReadOnly = true;
}
private void tb2_GotFocus(object sender, EventArgs e)
{
if (shouldFocus)
{
tb2.IsReadOnly = false;
}
}
private void tb1_LostFocus(object sender, EventArgs e)
{
tb1.IsReadOnly = true;
}
private void tb1_GotFocus(object sender, EventArgs e)
{
if (shouldFocus)
{
tb1.IsReadOnly = false;
}
}
private void Form1_Load(object sender, EventArgs e)
{
StyleDefinition style = new StyleDefinition();
tb1.IsReadOnly = true;
tb1.Document.Insert("text 1", style);
tb2.Document.Insert("text 2", style);
tb2.IsReadOnly = true;
}
private void radButton1_Click(object sender, EventArgs e)
{
if (shouldFocus)
{
tb2.Focus();
}
else
{
shouldFocus = true;
tb1.Focus();
}
}
}