Dropdown Multi-Select Sample Issue

6 posts, 0 answers
  1. Dale
    Dale avatar
    1 posts
    Member since:
    May 2014

    Posted 23 May 2014 Link to this post

    http://www.telerik.com/support/kb/winforms/details/multi-select-drop-down-list

    I've implemented the multi select drop down list from the above link and have found two quirks.  These issues are both related to the text displayed, I believe there are a few missing event handlers.1) When the popup is open, upon deselecting an item the text is not updated.  This works fine if the checkbox is deselected, but not the rest of the row (I assume this is the base drop down list).  Just need to call CallTextChanged(), but not sure what event to override to do so.2) Upon selecting an item programatically, the text is not updated.  For instance "DropDown1.Items(0).Selected = True" doesn't update the text of the drop down list.
  2. George
    Admin
    George avatar
    500 posts

    Posted 27 May 2014 Link to this post

    Hi Dale,

    Thank you for writing.

    This question is already answered in your support ticket "WinForm UI Drop Downl List - Multi Select Issue". I am copying the answer here as well so the community can benefit from it:
    The article is updated to address the mentioned points. You can download the updated project from its address.

    Do not hesitate to write back, should you have further questions.

    Regards,
    George
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Tejas
    Tejas avatar
    2 posts
    Member since:
    Jul 2014

    Posted 03 Jul 2014 Link to this post

    Hi Geroge,

    I have an issue with text wrapping for visual items. See the attached Image. The selected item is not wrapping up even I have set TextWrap property to true.

    Your help is much appreciated.
  5. George
    Admin
    George avatar
    500 posts

    Posted 08 Jul 2014 Link to this post

    Hello Tejas,

    Thank you for writing.

    In order to wrap the items first you need to set the AutoSizeItems property of the drop down to true. Then you need to subscribe to the VisualItemFormatting event and use the following code:
    void list_VisualListItemFormatting(object sender, VisualItemFormattingEventArgs args)
    {
        RadElement child = args.VisualItem.Children[0].Children[1];
        (child as LightVisualElement).TextWrap = true;
        child.MaxSize = new Size(child.Size.Width - 25, 0);
    }

    I hope this helps.

    Regards,
    George
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Tejas
    Tejas avatar
    2 posts
    Member since:
    Jul 2014

    Posted 09 Jul 2014 Link to this post

    Hi George,

    Thanks for your help. But this is not working somehow. It is not formatting correctly. For some items it is wrapping the text even if it is not required and for some items it is not wrapping up properly.

    I have attached the project. Your help is much appreciated.

    Somehow I am not allowed to upload ZIP files. So Please rename the attachment to .ZIP.

    Regards
    Tejas
  7. George
    Admin
    George avatar
    500 posts

    Posted 14 Jul 2014 Link to this post

    Hello Tejas,

    Thank you for writing back.

    Yes, the items are wrapped even when not needed in cases when the control is wider than the items. You can use the following code in order to properly calculate the width of the items:
    private void customDropDownList1_VisualListItemFormatting(object sender, VisualItemFormattingEventArgs args)
    {
        var child = args.VisualItem.Children[0].Children[1];
     
        (child as LightVisualElement).TextWrap = true;
     
        var control = this.customDropDownList1;
        int width = child.Size.Width > control.Width ? child.Size.Width : control.Width;
     
        child.MaxSize = new Size(width - 25, 0);
    }

    I hope this helps.

    Regards,
    George
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready