SlideableContentLayout is a very nice way of creating a slideable list of items on the fly. But what I feel like we are missing is an API that follows the way other Xamarin.Formslist controls is using in terms of the selected item.
API Changes
This is a screen shot of Xamarin.Forms.CollectionView selected item API:
SelectedItem can be used by a view model to get notified when the user has changed the selected item. Can also be set to TwoWay for the view model to update the selected item.
SelectedItemChanged, event that gives you the selected item as a event arg.
SelectionChangedCommand - Command to correspond with the SelectedItemChanged event, we already have this and it's called SelectedItemChangedCommand. But, our command is now sending the current item index. Maybe we should split and make an command that sends the selected item (object) and one that sends the index.
SelectionChangedCommandParameter - The optional command parameter we can send to the command when the selected item changed command is executed.
We could also include the following to make it possible for the user to look at the indexes instead of the objects:
SelectedIndex
SelectedIndexChanged
SelectedIndexChangedCommand
SelectedIndexChangedCommandParameter
Intended Use Case
SelectedItem - The consumer wants to get the view model setter set when the selected item changed. The consumer wants to set this property in the view model to make the view move.
Property, Events, command, commandparameter makes it possible for the consumer to choose what methods they want to use.
Summary
SlideableContentLayout is a very nice way of creating a slideable list of items on the fly. But what I feel like we are missing is an API that follows the way other
Xamarin.Forms
list controls is using in terms of the selected item.API Changes
This is a screen shot of
Xamarin.Forms.CollectionView
selected item API:SelectedItem
can be used by a view model to get notified when the user has changed the selected item. Can also be set toTwoWay
for the view model to update the selected item.SelectedItemChanged
, event that gives you the selected item as a event arg.SelectionChangedCommand
- Command to correspond with theSelectedItemChanged
event, we already have this and it's calledSelectedItemChangedCommand
. But, our command is now sending the current item index. Maybe we should split and make an command that sends the selected item (object) and one that sends the index.SelectionChangedCommandParameter
- The optional command parameter we can send to the command when the selected item changed command is executed.We could also include the following to make it possible for the user to look at the indexes instead of the objects:
SelectedIndex
SelectedIndexChanged
SelectedIndexChangedCommand
SelectedIndexChangedCommandParameter
Intended Use Case
SelectedItem
- The consumer wants to get the view model setter set when the selected item changed. The consumer wants to set this property in the view model to make the view move. Property, Events, command, commandparameter makes it possible for the consumer to choose what methods they want to use.