我对 C 编码和最重要的 C# 很陌生,所以我的问题是了解它是如何工作的。所以我真正想要的是,当您按下网格时,您将获得一个唯一的 id,具体取决于网格中显示的项目,而按下网格时,您将进入我想要显示 item.id 的新页面文件 1foreach (var item in list) { TapGestureRecognizer gridTap = new TapGestureRecognizer(); gridTap.Tapped += (sender, e) => { Navigation.PushModalAsync(new MarketItemPage()); item.Id = GridIdentifier.Grid_id; // item.id is the id of the choosen item = static int in class };}档案 2 public void Update() { string gridid = GridIdentifier.Grid_id.ToString(); grid.Children.Add(new Label { Text = gridid, FontSize = 16, FontFamily = "Arial", TextColor = Color.Red, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center, }); }班级public static class GridIdentifier{ public static int Grid_id { get; set; }}
- 1 回答
- 0 关注
- 201 浏览
添加回答
举报
0/150
提交
取消