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

Disallow Unselect

3 Answers 74 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Bruce
Top achievements
Rank 1
Bruce asked on 23 May 2017, 07:32 PM

I need to always have a row selected.  Therefore, I need to disallow or stop the de-selection of the currently-selected row.  The SelectionChanged event fires twice, once for the old Item being removed from SelectedItems and another for adding the new Item to SelectedItems.

I thought of attempting to use ItemTapped in conjunction with SelectionChanged but a) I also need to be able to select a row programmatically and b) the ItemTapped even fires sporadically on iOS.  Sometimes a tap will fire it; sometimes it won't.

 

I'm in SelectionMode=Single.

3 Answers, 1 is accepted

Sort by
0
Accepted
Rosy Topchiyska
Telerik team
answered on 25 May 2017, 01:05 PM
Hello Bruce,

Thank you for contacting us.

You can use the SelectedItems collection to programmatically select items. I have attached a sample that demonstrates this. Unfortunately, this will work on iOS only because we have an issue on Android where the selection is not properly updated when we modify the SelectedItems collection. I have raised the priority of the issue and the fix should be available in the next internal build.

You mentioned that the ItemTapped event does not always work on iOS, but I couldn't reproduce this issue. It could be something that is specific to your setup, could you please send us an example?

I look forward to your reply.

Regards,
Rosy Topchiyska
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Bruce
Top achievements
Rank 1
answered on 13 Jun 2017, 02:20 PM

I attempted to do something similar, but as you said, it does not work on Android and hence, is not an acceptable solution.  I'll continue to look for a fix.

I'll also see if I can create a separate project duplicating the iOS ItemTapped issue.

0
Stefan Nenchev
Telerik team
answered on 15 Jun 2017, 02:47 PM
Hello Bruce,

With the R2 SP 2017 release which is available as of yesterday, we have included a fix for the issue you are observing in Android. However, there is another undesired behavior we have diagnosed which can be replicated on devices that use 6.0 or later Android version(sometimes the items do not appear as selected although they actually are). We should have a fix for that with the next minor build(next Friday). With this in mind, I suggest you test the approach my colleague has suggested for devices that use a lower version of Android and wait until next Friday to test the higher versions.

Have a great rest of the week.

Regards,
Stefan Nenchev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListView
Asked by
Bruce
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Bruce
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Share this question
or