- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何使用 ViewCell 中的 Tapped 操作导航到其他页面?
Xmal代码
<TableView Intent="Settings" HasUnevenRows="true" VerticalOptions="StartAndExpand" BackgroundColor="White" >
<TableRoot>
<TableSection>
<ViewCell Height="100" Tapped="OnProfileClicked">
<ViewCell.View>
<StackLayout Orientation="Horizontal" Padding="5,2,5,2" BackgroundColor="White" >
<Image x:Name="ImgProfile" HeightRequest="100"/>
<Label x:Name="btnName" VerticalOptions="Center" TextColor="Black" FontSize="20"/>
<Label Text="> " FontSize="15" HorizontalOptions="EndAndExpand" VerticalOptions="Center"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</TableSection>
</TableRoot>
</TableView>
CS文件
public void onProfileTapped()
{
Navigation.PushAsync(new Clubs());
}
最佳答案
所以您的代码有几处错误。
1.) 你写了 Tapped=OnProfileClicked
但是你实际创建的方法叫做 onProfileTapped()
,这是不匹配的
2.) 项目点击事件的参数错误,大多数 Xamarin 事件都包含发送者和 eventArgs。
以下是修复代码以使其正常工作的方法:
void OnProfileClicked (object sender, System.EventArgs e) { //your code}
此外,提示,当您使用导航推送页面时。您可能希望将方法标记为异步并等待操作以确保它是平稳过渡。
关于c# - TableView Viewcell Tapped Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38342694/
更新:只是提醒一下,如果有人可以告诉我如何在不使用手势的情况下实现此功能,则有 500 分奖励> 我正在使用 ViewCell 和手势识别器使用以下代码打开选择器。 ViewCell 在左侧有一个标签
我的 xaml 页面上有以下带有绑定(bind)的 listView。我正在从我的 viewModel 将数据绑定(bind)到它。但是这些值没有绑定(bind)到单元格。
我有这个 XAML 代码: Card Selection
我对 JavaFX 非常陌生,想要创建一个自定义 listView,每个 ViewCell 包含 3 个标签和 2 个图像,并且我已在 fxml 文件中定义了它。为了简单起见,我在下面发布了一个仅使用
我希望我的 ListViews ViewCell 中的列都具有相同的大小。它目前设置为自动,最宽的名称应该获胜,所有其他列应该设置为最宽的标签宽度。目前它们每一行的宽度都不同。 ListView It
我已经在谷歌上搜索了一段时间,但没有找到解决方案。 我正在使用一个 nib 文件,它定义了一个我在多个 TableView 上重复使用的 View 单元格。 我的目标是针对不同的手机尺寸采用不同的 V
我建立了一个List<>项目对象的数量,这些对象被用作 ItemsSource到 ListView .在我的 ListView 上 ItemSelected事件,我试图更改该特定项目的元素之一。原始值
我正在尝试更改 listview 上的 ViewCell,但下面的代码对我不起作用:
您好,我使用 Xamarin Forms ListView,我想知道我是否可以基于特定绑定(bind)或在后面的代码中禁用上下文操作。 我为整个应用程序使用一个 GroupedListView,但它会
我在 Xamarin Forms XAML 中有一个 ListView,在这个 ListView 中,我想绘制一个带有 4 个标签和 1 个条目的网格。我的问题是,当我尝试显示 ListView 时,
如何使用 ViewCell 中的 Tapped 操作导航到其他页面? Xmal代码
tl;dr:如何在 Xamarin Forms 中像 iOS 邮件应用一样使用滑动来显示按钮 我正在尝试为类似于 iOS 邮件应用程序或此 https://components.xamarin.com
我有一个带有自定义 ViewCell 的 Xamarin.Forms ListView,其中包含一个带有条目和标签的 StackLayout。我希望在任何时候选择 ViewCell 时条目都能获得焦点
在this question on Xamarin Forums ,Craig Dunn 教授如何创建带框架的单元格。 我想在每个单元格之间添加一个空格。 目前单元格似乎粘在一起,ViewCell 没
我得到了一个带有内部角色系统的应用程序。根据当前角色,用户可以看到更多设置。对于每个设置,我都有一个 ViewCell。因此,就我而言,我想在开始时隐藏特殊设置,并在用户有权这样做时显示它们。 不幸的
我有一个带有按钮的自定义 ViewCell。当我单击此按钮时,我想在显示带有 ViewCell 的 ListView 的 ContentPage 中处理此单击。在 iOS 中,我会使用来自 Cell
我正在使用 ViewCell 在我的表格设置页面中创建行。我有一个设置可以选择浅色或深色主题。
我需要为 ListView View 单元左右滑动手势编写代码(或 XAML)。 向左滑动时,从 ListView (或可观察集合)列表中删除记录并更新 ListView 中剩余的列表项。向右滑动时,
我希望能够更改自定义 ViewCell 上的绑定(bind)属性,并更新 ListView 项 - 但它似乎仅用于初始化 View 并且变化没有反射(reflect)出来。请告诉我我缺少什么! 在这里
我正在 Xamarin.Forms 项目中处理 Accordion ListView。这意味着您可以单击 ListView 中的类别标题,这将展开或折叠其下方的子项。 每个类别标题中有两个图像和一个标
我是一名优秀的程序员,十分优秀!