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

Dropdown Multi-Select Sample Issue

5 Answers 190 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Dale
Top achievements
Rank 1
Dale asked on 23 May 2014, 02:50 PM
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.

5 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 27 May 2014, 06:43 AM
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.
 
0
Tejas
Top achievements
Rank 1
answered on 03 Jul 2014, 02:57 PM
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.
0
George
Telerik team
answered on 08 Jul 2014, 09:53 AM
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.
 
0
Tejas
Top achievements
Rank 1
answered on 09 Jul 2014, 01:00 PM
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
0
George
Telerik team
answered on 14 Jul 2014, 08:41 AM
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.
 
Tags
DropDownList
Asked by
Dale
Top achievements
Rank 1
Answers by
George
Telerik team
Tejas
Top achievements
Rank 1
Share this question
or