Adding Other Controls

3 posts, 1 answers
  1. Tim Larson
    Tim Larson avatar
    33 posts
    Member since:
    Sep 2007

    Posted 19 Jul 2018 Link to this post

    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. Tim Larson
    Tim Larson avatar
    33 posts
    Member since:
    Sep 2007

    Posted 19 Jul 2018 in reply to Tim Larson Link to this post

    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.
  3. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3903 posts

    Posted 20 Jul 2018 Link to this post

    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
Back to Top