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

Editable Combobox issue with SelectedItem

5 Answers 581 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Shailesh Shahane
Top achievements
Rank 1
Shailesh Shahane asked on 10 Aug 2009, 01:01 PM
Hi,
I'm having RadComboBox with properties IsEditable="True", IsTextSearchEnabled="True",  FilteringMode="StartsWith"
Items in Combo box are simple text and not in order.
E.g.
ABCD
AB
ABC
A

1) The problem is, if i select A then on SelectionChanged event i set focus to next control. This time combo box selected item show ABCD instead of Selected 'A' whereas Text of combo box shows 'A'.
even if i don't set focus to other control, if I select A and then clicks out of the Silverlight boundry on HTML and again clicks on Silverlight part then combo box got focus and same problem occurs. It shows Text A but selected Item is ABCD

i.e. It selects 1st element which starts with combobox text. But It doesn't shows that element it shows Text 'A'. which misleads user.

2) Secondly, If two Rad combo boxes are used, if I select first then goes to second using mouse then 1st drop down also get expanded. May be this is because of IsEditable behavior of combo box so on focus it get expanded. but this is also not giving good user experience.

3) If Text is more than combo box width, e.g. abcdefghij then only last characters are visible to fit with combo box width. e.g. it will show "cdefghij". Where user is more interested to see 1st characters i.e. "abcdefg" even if last char. are not visible.


-------------------------------------------
Here one more thing to add,
if i use non Editable combo box with search feature, and i'm having cascading combo box then on selection of 1st i'm populating other one. and i'm having values e.g.
ABC1
ABC2

where if i want to select "ABC2" then if i type "A" then 1st item matches get selected i.e. ABC1 and its SelectionChange event get fired which starts populating other combo box using WCF service. then on type of next characters B,C SelectionChange event again get fired which is not necessary. I want to populate other combobox on actual selection of item. But this behavior unnecessary make service calls.
If i can overcome this problem then all above mentioned problems can be resolved by using non Editable combo box.

any help will be greatly appreciated.

Thanks



5 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 14 Aug 2009, 01:33 PM
Hello Shailesh Shahane,

1) This appears to be a bug. The RadComboBox is getting confused is some way, because the first item contains the others, if the succession of items is A, AB, ABC, ABCD  it is working fine. We will investigate further and try to fix this.

2) I was unable to reproduce this one. So could you please send us a sample project where the problem can be clearly seen.

3) Regarding the selection in the combobox TextBox - currently the control does not provide a way to customize the behavior you describe. We used the standard WPF ComboBox as a model and tried to make RadComboBox as close as possible. The problem is related to the fact that RadComboBox selects all the text in its TextBox when it gets the focus or changes its selection, and the TextBox automatically scrolls its text. I could provide the following hack that overcomes the problem:
using Telerik.Windows.Controls;
...
private void RadComboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    TextBox textBox = RadComboBox1.ChildrenOfType<TextBox>().First();
    Dispatcher.BeginInvoke(() =>
        textBox.Select(textBox.SelectionStart, 0));
}


We will consider adding several properties or methods in the near future, that will help the developers to avoid such hacks.


4) We have tried to make the behavior of RadComboBox similar to the Microsoft Combobox in WPF. You can see that there also the selection changed event is fired on each keystroke. So this is by design.

Best wishes,
Boyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Shailesh Shahane
Top achievements
Rank 1
answered on 24 Sep 2009, 01:26 PM
Thanks Boyan,
  The work around given for problem 3 is works properly. However after selectionchange when focus comes to control again selection again goes to end of text. but its not in priority. Also I didn't find ChildrenOfType method, but i managed to write extension method and get textbox reference using VisualTreeHelper.
The 1st issue as you mentioned it appears to be bug with control, is there any new version available which resolves this issue or any expected date of new release?
Second problem, it seems it is not issue with combo box control, but a feature. As you said it imitates the WPF combo box, when control got focus it automatically opens dropdown. But since, silverlight is part of page and windowless, and combo box is first control on silverlight control; when i clicks on silverlight area, focus automatically sets to combo box and it expands. this is the case if combo box is Editable. Is there any other way to stop ths behavior.
I tried using gotfocus method of UserControl, also combo box and setting IsDropDownOpen = false but it doesn't works.
Is there any other workaround for this?

Thanks
0
Accepted
Kaloyan
Telerik team
answered on 30 Sep 2009, 07:51 AM
Hello Shailesh Shahane,

Sorry for the late response.

I suggest that you try to download the latest internal binaries (v2009.2 925) and check whether the problem still appears. Also, to use the ChildrenOfType  you should add a reference to the Telerik.Windows.Controls namespace in your code-behind. As about the focus problem - you can try to set IsDropDownOpen = false in the Dispatcher method:
Deployment.Current.Dispatcher.BeginInvoke(() => comboBox.IsDropDownOpen = false);

Please let us know how  this goes.

Best wishes,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Shailesh Shahane
Top achievements
Rank 1
answered on 12 Oct 2009, 12:12 PM
Hi Kaloyan ,

Thanks for response. As per your suggestion, i have downloaded internal build dlls. It seems the workaround you suggested (IsDropDownOpen = false using Dispatcher) is not required now, since the problem has been resolved in new build.
However, as mentioned by boyan, the issue with editable radcombobox when unordered items are added is not yet resolved.

"1) This appears to be a bug. The RadComboBox is getting confused is some way, because the first item contains the others, if the succession of items is A, AB, ABC, ABCD  it is working fine. We will investigate further and try to fix this"

Looking forward to next release would have tacked this issue. However, for the time we have managed all this issues by simply removing IsEditable feature.

Thanks for support,
Regards,
Shailesh

0
Valeri Hristov
Telerik team
answered on 16 Oct 2009, 08:10 AM
Hello Shailesh,

We recently fixed the item selection problem, I suggest trying a newer internal build. If this does not help, please, open a new support ticket and send us a simple application, including the referenced Telerik assemblies, that can be used to observe the problem. We will do our best to provide a fix before the Q3 release in the beginning of November.

Greetings,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
Shailesh Shahane
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Shailesh Shahane
Top achievements
Rank 1
Kaloyan
Telerik team
Valeri Hristov
Telerik team
Share this question
or