i have a ListView with Prism and i use EventToCommandBehavior to convert ItemTapped Event to command. i want to send parameter to ViewModel. here my code
*** Xaml
`
<ListView.Behaviors>
</ListView.Behaviors>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal" Spacing="10">
<!--<Image Source="{Binding URL1}" WidthRequest="75" HeightRequest="75"/>-->
<ffimageloading:CachedImage WidthRequest="75" HeightRequest="75"
DownsampleToViewSize="true"
Source = "{Binding URL1}">
</ffimageloading:CachedImage>
<StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding ViTri}" FontSize="14" TextColor="Black" />
<Label Text="{Binding ViPhamID}" FontSize="14" TextColor="Black" />
</StackLayout>
</StackLayout>
</StackLayout>
</ViewCell.View>
<!--<Grid Padding="5">
-->
<!--<Image Source="{Binding URL1}" Width="10" Height="10"/>-->
<!--
</Grid>-->
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
`
***C#
ItemSelectedCommand = new DelegateCommand<string>(async x => { await Application.Current.MainPage.DisplayAlert("Thong Bao", $"{x.ToString()}", "tat"); });
(**) ViPhamID is one field in list object
in ViewModel x = null
i dont know how.
please help me.
sorry my english is not good