[Bug] Cannot navigate via EventToCommandBehavior in XAML #2484
Closed
Description
Description
When attempting to navigate via XAML and EventToCommandBehavior
like so:
<ListView.Behaviors>
<prism:EventToCommandBehavior EventName="ItemTapped"
Command="{prism:NavigateTo 'DetailPage'}"
EventArgsParameterPath="Item" />
</ListView.Behaviors>
The following exception is thrown:
System.ArgumentNullException: 'Value cannot be null.
Parameter name: TargetElement'
Steps to Reproduce
- Setup a ListView containing elements in XAML
- Use
EventToCommandBehavior
to execute a command on theItemTapped
event - Use Prism XAML navigation in the Command property for the
EventToCommandBehavior
- The exception is thrown when tapping an item in the ListView
Expected Behavior
The navigation to occur when tapping the item.
Actual Behavior
The above exception is thrown.
Basic Information
- Version with issue: 8.1.97
- Last known good version: n/a
- Xamarin.Forms version: 5.0.0.2012
- IDE: Visual Studio 16.9.6
Reproduction Link
A Visual Studio solution that demonstrates the issue is here. Run the app on Android, tap a name in the ListView, the exception will occur.
Thanks!