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

Adding Other Controls

2 Answers 60 Views
Conversational UI, Chat
This is a migrated thread and some comments may be shown as answers.
Tim Larson
Top achievements
Rank 1
Tim Larson asked on 19 Jul 2018, 08:38 PM

Would it be possible to add other controls like a combobox or list view into the Chat UI? If the user has many choise I wouldn't want to fill the screen with all of the choices.

 

Thanks,

Tim

2 Answers, 1 is accepted

Sort by
0
Tim Larson
Top achievements
Rank 1
answered on 19 Jul 2018, 08:45 PM
I know there is the list overlay but I was thinking of just injecting a multi-column combobox to show multiple columns of data to help the user choose easier.
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Jul 2018, 08:17 AM
Hello, Tim,    

RadChat allows you to create custom items and add any element that you need in the chat messages. A sample approach is demonstrated in the following help article: https://docs.telerik.com/devtools/winforms/chat/customizing-appearance/custom-items

When you need to offer the user a list of options, the ChatListOverlay is the appropriate solution as you can select an item from a predefined list of choices. If you wish to display a RadMultiColumnComboBox you can create a custom ChatListOverlay. a sample approach is demonstrated in the following code snippet: 

public RadForm1()
{
    InitializeComponent();
    CustomBaseChatItemOverlay listOverlay = new CustomBaseChatItemOverlay("List overlay");
    DataTable dt = new DataTable();
    dt.Columns.Add("Id", typeof(int));
    dt.Columns.Add("Name", typeof(string));
    for (int i = 0; i < 10; i++)
    {
        dt.Rows.Add(i, "Item" + i);
    }
    listOverlay.Mccb.DisplayMember = "Name";
    listOverlay.Mccb.ValueMember = "Id";
    listOverlay.Mccb.DataSource = dt;
    bool showAsPopup = false;
    Author author = new Author(Properties.Resources.AndrewFuller, "Andrew");
    this.radChat1.Author = author;
    ChatOverlayMessage overlayMessage = new ChatOverlayMessage(listOverlay, showAsPopup, author, DateTime.Now);
    this.radChat1.AddMessage(overlayMessage);
}
 
public class CustomBaseChatItemOverlay : BaseChatItemOverlay
{
    public CustomBaseChatItemOverlay(string title) : base(title)
    {
        this.mccb.SelectedValueChanged += mccb_SelectedValueChanged;
    }
 
    public RadMultiColumnComboBox Mccb
    {
        get
        {
            return this.mccb;
        }
    }
 
    private void mccb_SelectedValueChanged(object sender, EventArgs e)
    {
        if (this.mccb.SelectedItem != null)
        {
            this.CurrentValue = this.mccb.SelectedValue;
        }
    }
 
    RadMultiColumnComboBox mccb;
 
    protected override Telerik.WinControls.RadElement CreateMainElement()
    {
        mccb = new RadMultiColumnComboBox();
        return new RadHostItem(this.mccb);
    }
 
    protected override void DisposeManagedResources()
    {
        this.mccb.SelectedValueChanged -= mccb_SelectedValueChanged;
        base.DisposeManagedResources();
    }
}




I hope this information helps. If you have any additional questions, please let me know.  
 
Regards,
Dess
Progress TelerikRadChat for Winforms
Tags
Conversational UI, Chat
Asked by
Tim Larson
Top achievements
Rank 1
Answers by
Tim Larson
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or