C#开发android之alertdialog用法

       // void okclick(object sender, DialogClickEventArgs e)
       //{
       //    TableRow tablerow1 = sender as TableRow;
       //    this.tablayout.RemoveView(tablerow1);
       //}  
     
       //长按此行删除事件
       void row_LongClick(object sender, View.LongClickEventArgs e)
       {
           TableRow tablerow1 = sender as TableRow;
           Button buttemp = (Button)tablerow1.GetChildAt(5);
           //tablerow1 = (TableRow)buttemp.Parent;
           if (buttemp.Text.CompareTo("完成") == 0)
           {               
               AlertDialog.Builder dialog = new AlertDialog.Builder(this);
               IDialogInterfaceOnClickListener listener = null;
               dialog.SetNegativeButton("取消", listener);
               dialog.SetPositiveButton("删除",
                   new EventHandler(delegate(object send,DialogClickEventArgs e1)
                   {
                       this.tablayout.RemoveView(tablerow1);
                   }));

                //new EventHandler(okclick));
               dialog.Show();
           }
       }

你可能感兴趣的:(C#开发android)