Xamarin表单表查看所选项目处理程序?

Xamarin表单表查看所选项目处理程序?,xamarin,tableview,xamarin.forms,Xamarin,Tableview,Xamarin.forms,当用户单击表格单元格时,我需要触发一个命令 我在tablecell上看到过,它没有提到任何点击事件处理程序 这就是我的XAML的外观- <ContentPage Title="Default"> <TableView> <TableView.Root> <TableSection> <ViewCell>

当用户单击表格单元格时,我需要触发一个命令

我在tablecell上看到过,它没有提到任何点击事件处理程序

这就是我的XAML的外观-

<ContentPage Title="Default">
    <TableView>        
        <TableView.Root>
            <TableSection>
                <ViewCell>
                    <StackLayout Padding="10,0,0,0" Orientation="Horizontal">
                    <Image Source="..." />
                    <Button Text="Home" Command="{Binding NavigateCommand}" CommandParameter="Home" />
                    </StackLayout>
                </ViewCell>
            </TableSection>
        </TableView.Root>
    </TableView>     
</ContentPage>

现在,命令只在单击按钮时触发,但我想在单击单元格时触发命令

我是xamarin的新手,自定义viewcell渲染是实现这一点的唯一方法吗

如果有,有什么建议吗


谢谢

您可以在
ViewCell
中使用
点击的
手势识别器

Xaml:
谢谢当我添加codebehind时,由于找不到方法而失败<代码>Xamarin.Forms.Xaml.XamlParseException类型的异常发生在Xamarin.Forms.Xaml.dll中,但未在用户代码中处理。其他信息:位置17:23。在MyApp.Views.AppMasterDetailPage类型上找不到任何方法
有什么想法吗?@Yash启用Xaml编译,以便在编译时与运行时之间找到错误源。xaml源代码与代码隐藏文件不匹配<代码>[assembly:XamlCompilation(XamlCompilationOptions.Compile)]
谢谢,我正在使用,这可能就是它不同的原因,我会尝试一下,但我认为这是另一个问题。这应该是正确的答案,我感到失望的是,我没有在中看到
点击
。@Yash看起来像一个文档生成问题,因为它是
单元格
类型,应该链接回显示OnTapped/Tapped()
<TableView>
    <TableView.Root>
        <TableSection>
            <ViewCell Tapped="OnViewCellTapped">
               ~~~~~
            </ViewCell>
        </TableSection>
    </TableView.Root>
</TableView>
protected void OnViewCellTapped(object sender, EventArgs e)
{
    System.Diagnostics.Debug.WriteLine("Tapped");
}