RadComboBoxElement

4 posts, 0 answers
  1. Csaba Szolomajer
    Csaba Szolomajer avatar
    5 posts
    Member since:
    Oct 2009

    Posted 27 Apr 2011 Link to this post

    Hi,

    We would like to use telerik winform controls. So we start to test demo version.
    We have a strange issue about the RadComboBoxElement placed on radribbonbar.

    When I use the autocompletemod with SuggestAppend option at the first bind something happen with the popup list. (image attached wrong.png). When I click the arrow of the texbox part of the combobox,  the popup hide, after a click again the popup part shows correctly. (image attached good.png)

    We use this event:

      
    private void comboboxSearchAddress_TextChanged(object sender, EventArgs e)
            {
                if (comboboxSearchAddress.Text.Length > 2)
                {
      
                    List<AddressPointType>
                        liAddrs = AddressPoint.SearchAddress(comboboxSearchAddress.Text);
      
                    string s = comboboxSearchAddress.Text;
                     comboboxSearchAddress.Text = "";
                     comboboxSearchAddress.Items.Clear();
                    for (int i = 0; i < liAddrs.Count; i++)
                    {
                         
                        comboboxSearchAddress.Items.Add(new RadComboBoxItem(liAddrs[i].Caption,liAddrs[i]));
      
                    }
                    comboboxSearchAddress.Text = s;
                    comboboxSearchAddress.Select(comboboxSearchAddress.Text.Length, 0);
                    
                }
            }



    Any Idea appreciate.
    Thanks.
    Csaba

  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 02 May 2011 Link to this post

    Hi Csaba,

    Thank you for writing.

    The code that you have sent will throw StackOverflowException, since in the TextChanged event you are rebinding the combo box and in the end your are setting back the text of the combo box, which will trigger the event again and again.

    In order to use the auto complete functionality of the combo box, just set its AutoCompleteMode property to the desired mode. Here is an example of this:
    public Form1()
    {
        InitializeComponent();
     
        List<MyObject> towns = new List<MyObject>
            {
                new MyObject("Sofia", 1000),
                new MyObject("London", 2222),
                new MyObject("Munich", 3333),
                new MyObject("Los Angeles", 4444),
                new MyObject("Boston", 5555)
            };
     
        for (int i = 0; i < towns.Count; i++)
        {
            radComboBoxElement1.Items.Add(new RadComboBoxItem(towns[i].town, towns[i].zipCode));
        }
     
        radComboBoxElement1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
    }
     
    class MyObject
    {
        public string town { get; set; }
        public int zipCode { get; set; }
     
        public MyObject(string town, int zipCode)
        {
            this.town = town;
            this.zipCode = zipCode;
        }
    }

    More information about the auto complete functionality can be found in this help article.

    If this is not your case and your are trying to achieve something different, please write back with the exact details on your scenario. 

    I am looking forward to your reply.

    Best wishes,
    Stefan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Csaba Szolomajer
    Csaba Szolomajer avatar
    5 posts
    Member since:
    Oct 2009

    Posted 11 May 2011 Link to this post

    Hi,
    Thanks for your reply.

    So I would like to achieve this working method:

    Start to type a city name. After 3 character typing (Bud) , I try to bind the auto complete list with city names like typed chars (Budapest, Budakeszi, Budaőrs). After select one from the auto complete list, I type the street name (Budapest H).  The suggested list (Budapest Hollos street, Budapest Hall street, Budapest Hamburger street .....) After that I would like to choose one exact address from the auto complete list. So U see I would like to change the object list continuously behind the auto complete data source.

    Thanks
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 16 May 2011 Link to this post

    Hello Csaba,

    Thank you for writing back.

    If I understand correctly your scenario you want to bind the combo box to a source with towns, select a town and after that in the same combo you want to change its data source to a source with streets, select a street and after the street is selected to bind ones again the combo to a source with predefined exact addresses and choose the address. However, I am not sure regarding the selected values. What should happen with the selected town, city or address value? Where are you going to store them? Please, could you elaborate a bit more and describe the exact behavior that you want to achieve. 

    I will be glad to help further and I am looking forward to your reply.
     
    Greetings,
    Stefan
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Back to Top