c# - 如何为 Xamarin Forms ListView 创建消息框?

标签 c# xamarin.forms

问题很简单。我需要为创建的 ListView 应用程序中的单元格提供一个消息框。然而我失败了,因为我第一次这样做是在一个非 XamarinForms 应用程序中。现在我不知道如何创建一个响应每个单元格的消息框。

代码;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;

namespace IconsApp
{
public partial class ListViewPage : ContentPage
{
    public ListViewPage()
    {
        InitializeComponent();

        MainListView.ItemsSource = new List<Element>
        {
            new Element {new Title = "ok", Description= "ok"},new Element {Title = "ok", Description = "ok"},
    }

最佳答案

MainListView.ItemSelected += (sender, e) => { 
  var item = (Element) e.SelectedItem;
  DisplayAlert(item.Title,item.Description,"OK");
};

关于c# - 如何为 Xamarin Forms ListView 创建消息框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40306115/

相关文章:

c# - 简单 WebClient 仅按名称不工作 : Customized cultures cannot be passed by LCID,

c# - Forms Authentication 理解 context.user.identity

c# - 在 .net 代码中在运行时编辑 HTML 电子邮件模板

xamarin.forms - Xamarin 形式的自定义键盘

Xamarin 表单中的 Firebase 分析

c# - 无法转换类型为 'Microsoft.Office.Interop.Outlook.ApplicationClass' {00063001-0000-0000-C000-000000000046} HRESULT : 0x80040155 的 COM 对象

c# - Asp.NET 在发布到 IIS 服务器时显示 "The Directory is invalid"

c# - Xamarin Android 构建失败 "Invalid value for outputAssembly"

android - [MissingMethodException:未找到 Xamarin.Forms.Maps.Android.MapRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) 的构造函数]

c# - Xamarin Forms 拉取异步表。CreateQuery() 默认添加了 OFFSET