Hi Cédric,
This is expected because SelectedItem will be the first item in SelectedItems. When using MultipleSelection, you should only use the SelectedItems collection. Let me provide two options you can move forward with.
SelectionChanged
I recommend using the
NotifyCollectionChangedArgs (e.g. NewItems, OldItems) instead of manually going through the sender and working with the RadListView directly. It is possible to take the approach you had, but you also have to worry about what items to deselect.
Instead, take advantage of the event args. I've attached a demo for you. For your convenience, here is the relevant code:
<
ContentPage
... >
<
Grid
>
<
telerikDataControls:RadListView
x:Name
=
"rlv1"
SelectionChanged
=
"listView_SelectionChanged"
SelectionMode
=
"Multiple"
>
<
telerikDataControls:RadListView.ItemTemplateSelector
>
<
local:VenteBoxOptionSelector
>
<
local:VenteBoxOptionSelector.TemplateDefault
>
<
DataTemplate
>
<
listView:ListViewTemplateCell
>
<
StackLayout
Orientation
=
"Horizontal"
>
<
Label
Margin
=
"10"
Text
=
"{Binding TxtLabel}"
/>
<
Label
Margin
=
"10"
Text
=
"{Binding IsSelected}"
/>
<
Label
Margin
=
"10"
Text
=
"Texte séparé grace au StackLayout"
/>
</
StackLayout
>
</
listView:ListViewTemplateCell
>
</
DataTemplate
>
</
local:VenteBoxOptionSelector.TemplateDefault
>
<
local:VenteBoxOptionSelector.TemplateClicked
>
<
DataTemplate
>
<
listView:ListViewTemplateCell
>
<
StackLayout
Orientation
=
"Horizontal"
>
<
Label
Margin
=
"10"
Text
=
"{Binding TxtLabel}"
/>
<
Label
Margin
=
"10"
Text
=
"{Binding IsSelected}"
/>
<
Label
Margin
=
"10"
Text
=
"Essai en cliquant"
/>
</
StackLayout
>
</
listView:ListViewTemplateCell
>
</
DataTemplate
>
</
local:VenteBoxOptionSelector.TemplateClicked
>
</
local:VenteBoxOptionSelector
>
</
telerikDataControls:RadListView.ItemTemplateSelector
>
</
telerikDataControls:RadListView
>
</
Grid
>
</
ContentPage
>
Here is the result ta runtime
ItemTapped
If you want to keep using use your current approach, I recommend switching to the ItemTapped event instead, but still use the event args instead of the sender:
Other Observations
Another thing I noticed while building the demo, You have TwoWay binding set up for the Label property that shows the value of IsSelected. This would attempt to set the value of IsSelected with an empty string. Remove the TwoWay binding.
I hope this helps!
Regards,
Lance | Tech Support Engineer, Sr.
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