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

ListPicker Multiselect always selects first item

4 Answers 174 Views
ListPicker
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike
Top achievements
Rank 1
Mike asked on 05 Jul 2012, 02:34 PM
I pulled my hair out for an hour thinking it was my code, looked through the documentation, and finally found a reference to some obscure "feature" of the ListPicker where it always selects the first item http://www.telerik.com/community/forums/windows-phone/listpicker/setting-radlistpicker-itemssource-causes-selectionchanged-to-fire-with-index-set-to-0.aspx

That post is also wrong, RadListPicker does support null selection in Multiselect mode.

Regardless, here's my issue.  Change the following two lines of code in your sample for ListPicker Multiselect.xaml.cs:

this.categoryListPicker.SelectedItems.Add(categoryItemsSource[0]);

this.categoryListPicker.SelectedItems.Add(categoryItemsSource[1]);

Make them this

 

this.categoryListPicker.SelectedItems.Add(categoryItemsSource[1]);

this.categoryListPicker.SelectedItems.Add(categorytemsSource[2]); 

Now explain why your simple sample app selects three items when you havigate to the page.  ListPicker always selects ItemsSource[0].  It also for some reason calls the SummaryForSelectedItemsDelegate twice on initialization.  Just step your sample code.

 

4 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 05 Jul 2012, 02:46 PM
Hello Мiке,

The forum post below you refer to was created *before* the ListPicker support multiple selection and of time was writing was correct.

I checked the scenario you described and could not reproduce the issue you are reporting - the category list picker has two values selected.

I did however reproduced the fact that the summary delegate is called twice - we will investigate this further.

Can you please tell us what version of the assemblies you are using and if possible a sample project that we can investigate.

Regards,
Valentin.Stoychev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Mike
Top achievements
Rank 1
answered on 05 Jul 2012, 04:30 PM
I am using 2012.2.0607.2040 Telerik.Windows.Controls.Input.dll

I experienced this issue in my app, so I investigated and am able to recreate the problem in ExamplesCS_WP Multiselect.xaml.cs.

By changing the index of the items added to the categoryListPicker.SelectedItems to not include index 0, the control will automatically add index 0.

I've attached screen shots of the code changes and the app running with index 0 selected.



0
Mike
Top achievements
Rank 1
answered on 05 Jul 2012, 05:20 PM
I updated to 2012.2.629.2040 and the issue no longer exists in your sample or in my application.  I'm sure if you investigate with version 2012.2.0607.2040 you will see the bug.

The SummaryDelegate is still called twice.
0
Valentin.Stoychev
Telerik team
answered on 06 Jul 2012, 05:52 AM
Hello Mike,

Thanks for the update. Yes, we will investigate the issue with the double calls to the summary delegate.

Please let us know if we can help with anything else.

Greetings,
Valentin.Stoychev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ListPicker
Asked by
Mike
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Mike
Top achievements
Rank 1
Share this question
or