I am attempting to add a RadSyntaxEditorElement to Telerik Chat UI for Winforms using 2023.3.1010 Trial.
I receive a null reference exception in RadSyntaxEditorElement.cs > SyncZoomComboText line 1312. It says base.Dispatcher = null. (see attached image).
Is it possible to add the SyntaxEditorElement to chat? If, not do you have any other recommendations for display code in chat?
Here is my test code modified from the examples found on your site.
public class MyCodeMessageItemElement : TextMessageItemElement
{
protected override Type ThemeEffectiveType
{
get
{
return typeof(TextMessageItemElement);
}
}
protected override LightVisualElement CreateMainMessageElement()
{
return new CustomCodeMessageBubbleElement();
}
public override void Synchronize()
{
base.Synchronize();
CustomCodeMessageBubbleElement bubble = this.MainMessageElement as CustomCodeMessageBubbleElement;
bubble.DrawText = false;
}
}
public class CustomCodeMessageBubbleElement : ChatMessageBubbleElement
{
protected override Type ThemeEffectiveType
{
get
{
return typeof(ChatMessageBubbleElement);
}
}
//RadTextBoxControlElement textBoxElement;
RadSyntaxEditor radSyntaxEditor;
RadSyntaxEditorElement radSyntaxEditorElement;
public RadSyntaxEditor SyntaxEditor1
{
get
{
return this.radSyntaxEditor;
}
}
protected override void CreateChildElements()
{
base.CreateChildElements();
radSyntaxEditorElement = new RadSyntaxEditorElement();
radSyntaxEditorElement.ZoomComboBox.Enabled = false;
//radSyntaxEditor.ContextMenuOpening += textBoxElement_ContextMenuOpening;
this.Children.Add(radSyntaxEditorElement);
}
//private void textBoxElement_ContextMenuOpening(object sender, TreeBoxContextMenuOpeningEventArgs e)
//{
// foreach (RadItem item in e.ContextMenu.Items)
// {
// if (item.Text.Contains("&Copy"))
// {
// item.Visibility = ElementVisibility.Visible;
// }
// else
// {
// item.Visibility = ElementVisibility.Collapsed;
// }
// }
//}
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
this.radSyntaxEditor.Text = value;
}
}
}