Hi, I’m using custom column that contains telerik rich text box.
My problem is that when I mark some text in the rich text box and clicking on one of the formatting options in the formatting popup dialog the focus of the richtext box is lost and the formatting is not applied on the selected text.
Here is my code
public class RichTextColumn : Telerik.Windows.Controls.GridViewBoundColumnBase //GridViewColumn
{
public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
{
var richTextBox = cell.Content as RadRichTextBox;
if (richTextBox == null)
{
richTextBox = new RadRichTextBox();
richTextBox.IsReadOnly = true;
richTextBox.SetBinding(RadRichTextBehaviours.RTFDocumentProperty, DataMemberBinding);
richTextBox.IsHitTestVisible = false;
richTextBox.AcceptsTab = false;
richTextBox.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
richTextBox.IsSpellCheckingEnabled = false;
richTextBox.VerticalAlignment = VerticalAlignment.Top;
richTextBox.BorderThickness = new Thickness(0);
RadRichTextBehaviours.SetCancelSelectionOnLostFocus(richTextBox, true);
cell.Content = richTextBox;
}
else
{
richTextBox.IsReadOnly = true;
}
return richTextBox;
}
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
{
var richTextBox = new RadRichTextBox();
richTextBox.SetBinding(RadRichTextBehaviours.RTFDocumentProperty, DataMemberBinding);
richTextBox.AcceptsTab = false;
richTextBox.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
richTextBox.IsSpellCheckingEnabled = false;
richTextBox.VerticalAlignment = VerticalAlignment.Top;
richTextBox.BorderThickness = new Thickness(0);
RadRichTextBehaviours.SetCancelSelectionOnLostFocus(richTextBox, true);
return richTextBox;
}
}
Can you please help?
Thanks, Rotem.