using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
[assembly: XamlCompilation (XamlCompilationOptions.Compile)]
namespace App31
{
 public partial class App : Application
 {
        TableSection tableSection;
  public App ()
  {
   InitializeComponent();
            var textCell = new TextCell
            {
                Text = "TextCell Text",
                Detail = "TextCell Detail"
            };
            var entryCell = new EntryCell
            {
                Label = "EntryCell",
                Placeholder = "Default Keyboard",
                Keyboard = Keyboard.Default
            };
            tableSection = new TableSection("Table Section 1")
            {
                textCell,entryCell
            };
            var tableView = new TableView
            {
                Intent = TableIntent.Settings,
                Root = new TableRoot("Table Title")
                {
                    tableSection
                }
            };
            MainPage = new ContentPage
            {
                Content = tableView
            };
            var addAction = new MenuItem {Text= "插入操作" };
            var delAction = new MenuItem {Text= "删除操作" };
            addAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
            delAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
            textCell.ContextActions.Add(addAction);
            textCell.ContextActions.Add(delAction);
            addAction.Clicked += AddAction_Clicked;
            delAction.Clicked += DelAction_Clicked;
  }
        private void DelAction_Clicked(object sender, EventArgs e)
        {
            tableSection.RemoveAt(tableSection.Count - 1);
        }
        private void AddAction_Clicked(object sender, EventArgs e)
        {
            var swithCell = new SwitchCell
            {
                Text = "SwitchCell",
                On = true
            };
            tableSection.Add(swithCell);
        }
        protected override void OnStart ()
  {
   // Handle when your app starts
  }
  protected override void OnSleep ()
  {
   // Handle when your app sleeps
  }
  protected override void OnResume ()
  {
   // Handle when your app resumes
  }
 }
}

XF 表视图添加和删除行的更多相关文章

  1. IOS之表视图添加搜索栏

    下面是我们要实现的效果.本效果是在上一篇自定义表视图的基础上进行更改的.     1.将Search bar and search display拖动到ViewController中.不要添加Sear ...

  2. IOS之表视图添加索引

    我们要实现的效果如下. 1.修改ControlView.h,即添加变量dict,用于存储TabelView的数据源. #import <UIKit/UIKit.h> @interface  ...

  3. IOS开发之表视图添加索引

    我们要实现的效果如下. 1.修改ControlView.h,即添加变量dict,用于存储TabelView的数据源. #import <UIKit/UIKit.h> @interface  ...

  4. 表视图控制器(TableViewController)(三) 、 表视图搜索

    1 乐库的设置界面 1.1 问题 tableView分为静态(static)和动态(dynamic),之前使用的都是动态的tableView,表视图的有多少分区.有多少行以及每一行显示的内容都不是固定 ...

  5. sql server 创建视图添加表时出现从其他数据库导入的表未显示出来

    创建视图添加表时出现从其他数据库导入的表未显示出来,通过数据库刷新,也不能解决.关闭SQL server management studio 后,再次进入,在创建视图的时候添加表的列表就出现了新导入的 ...

  6. 表视图控制器(TableViewController)(二)

    1 tableView的编辑模式 1.1 问题 表视图可以进入编辑模式,当进入编辑模式就可以进行删除.插入.移动单元等操作,本案例还是使用联系人界面学习如何进入编辑模式,以及进入编辑模式之后的删除.插 ...

  7. Swift 可展开可收缩的表视图

    主要学习与运行效果 在本节的内容中,我们将通过一个具体实例的实现过程,详细讲解在表视图当中,如何创建一个可展开可收缩的表视图.为了让读者有着更为直观的印象,我们将通过模仿QQ好友列表来实现这个效果. ...

  8. IOS开发-表视图LV3导航控制器

    学到这里感觉有点难了,其实这篇文章再草稿箱里放了好久了~ 最近对于学习的热情下降了.这不行-抓紧学习走起! 在这一章节的学习中主要针对导航控制器及表视图来建立多视图的应用, 首先要了解一些概念-- 1 ...

  9. iOS开发之多表视图滑动切换示例(仿"头条"客户端)---优化篇

    前几天发布了一篇iOS开发之多表视图滑动切换示例(仿"头条"客户端)的博客,之所以写这篇博客,是因为一位iOS初学者提了一个问题,简单的写了个demo做了个示范,让其在基础上做扩展 ...

随机推荐

  1. php求二叉树的深度(1、二叉树就可以递归,因为结构和子结构太相似)(2、谋而后动,算法想清楚,很好过的)

    php求二叉树的深度(1.二叉树就可以递归,因为结构和子结构太相似)(2.谋而后动,算法想清楚,很好过的) 一.总结 1.二叉树就可以递归,因为结构和子结构太相似 2.谋而后动,算法想清楚,很好过的 ...

  2. 驱动程序调试方法之printk——printk的原理与直接使用

    1.基本原理 (1)在UBOOT里设置console=ttySAC0或者console=tty1 这里是设置控制终端,tySAC0 表示串口, tty1 表示lcd(2)内核用printk打印 内核就 ...

  3. 【42.07%】【codeforces 558A】Lala Land and Apple Trees

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  4. MySQL参数文件位置

    对于linux/unix: mysql --help|grep my.cnf   /etc/my.cnf, /etc/mysql/my.cnf, /usr/local/etc/my.cnf, ~/.m ...

  5. [tmux] Enable mouse mode in tmux

    We'll learn how to use mouse mode in tmux, including enable mouse control for resizing, scrolling an ...

  6. [Vue] Get up and running with vue-router

    How do we set up a simple app with its own routes with their own components in Vue? Install: npm i - ...

  7. 基于GTID多源复制扩展

    对一个运行很久的库做备份恢复建同步 不能使用xtrabackup   使用mysqldump导数据: mysqldump -S /data/mysql/3307/tmp/3307.sock --sin ...

  8. [HTML5] Focus management using CSS, HTML, and JavaScript

    Something important to consider when coding a web application is managing the user's focus. For keyb ...

  9. Qt Roadmap for 2018(对3D有很多改进)

    When it comes to new features, we have many things ongoing related to graphics, so I’ll start with t ...

  10. WPF入门(三)->几何图形之线条(LineGeometry)

    原文:WPF入门(三)->几何图形之线条(LineGeometry) 前一章我们对wpf的xaml语言有了一定的了解,那么我们现在开始来学习如何使用wpf来画出几何图形. LineGeometr ...