Hi,
I think I found a Bug in ItemSelected Event Handler of a list view. I have the following layout:
var listView = new ListView()
{
ItemsSource = _viewModel.Items,
ItemTemplate = new DataTemplate(CreateListViewItemTemplate),
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
};
listView.ItemSelected += (sender, args) =>
{
_viewModel.ItemTapped((IItem) args.SelectedItem);
};
private ViewCell CreateListViewItemTemplate()
{
var detailsButton = new Button()
{
Text = "Details",
HorizontalOptions = LayoutOptions.End,
};
detailsButton.Clicked += (sender, args) =>
{
_viewModel.DetailsTapped((IItem)(sender as View).BindingContext);
};
itemStackLayout.Children.Add(detailsButton);
return new ViewCell()
{
View = itemStackLayout
};
}
Every Item has a button for navigating to a detail page (the actual click on the item should do something other, so this is currently ok).
The problem is: If you click on the button, the event handler for that button is executed, after that the event handler for "ItemSelected" for the listview is executed.
Is this is bug or standard behavior?