Winform UI becomes not responding.

4 posts, 0 answers
  1. Jithin
    Jithin avatar
    2 posts
    Member since:
    Sep 2016

    Posted 01 Sep Link to this post

    Hi,

    I am using CheckedDropDownList control in my UI. I have nearly 154 items to be handled with this control. So the UI becomes hanging after selecting and clearing it programmatically. I am using the following codes.

    For selection

    foreach (var text in dbValues)
        {
            foreach (RadCheckedListDataItem item in this.radCheckedDropDownList1.Items)
            {
                if (item.Text == text)
                {
                    item.Checked = true;
                }
            }
        }

    For Clearing

    radCheckedDropDownList1. CheckedItems.Clear();

    if there any convenient way to do this??. Please advice.

     

     

  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 01 Sep Link to this post

    Hello Jithin,

    Thank you for writing.  

    In order to check multiple items programmatically, note that it is recommended to use Begin/EndUpdate methods to optimize performance. Thus, the UI will be refreshed at the end but not at each checking the item. You can refer to the attached sample project for your convenience.

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jithin
    Jithin avatar
    2 posts
    Member since:
    Sep 2016

    Posted 02 Sep in reply to Dess Link to this post

    Hi Dess,

     Thanks for the response. I have already tried the code for clearing the items you have mentioned. But instead of clearing entire items I only want to clear the checked items from the list. When I am doing this it becomes slow and the UI becomes unresponsive. So is there any way to handle it??

  5. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 05 Sep Link to this post

    Hello Jithin, 

    Thank you for writing back. 

    In order to remove the checked items fast, you can use the BeginUpdate/EndUpdate methods as well:
    private void radButton2_Click(object sender, EventArgs e)
    {
        BindingList<RadCheckedListDataItem> checkedItems = new BindingList<RadCheckedListDataItem>();
        for (int i = 0; i < this.radCheckedDropDownList1.CheckedItems.Count; i++)
        {
            checkedItems.Add(this.radCheckedDropDownList1.CheckedItems[i]);
        }
         
        this.radCheckedDropDownList1.ListElement.BeginUpdate();
        while (checkedItems.Count > 0)
        {
            this.radCheckedDropDownList1.Items.Remove(checkedItems[0]);
            checkedItems.RemoveAt(0);
        }
      
        this.radCheckedDropDownList1.ListElement.EndUpdate();
        this.radCheckedDropDownList1.Text = string.Empty;
    }

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top