using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace App29
{
 public partial class MainPage : ContentPage
 {
  public MainPage()
  {
   InitializeComponent();
            var states = new List<State>()
            {
                new State("FL")
                {
                    new City{ Name="beijing" },
                     new City{ Name="shanghai"}
                },
                new State("AL")
                {
                     new City{ Name="guangzhou"},
                    new City{ Name="shenzhen"},
                }
              
            };
            var dataTemplate = new DataTemplate(typeof(TextCell));
            dataTemplate.SetBinding(TextCell.TextProperty, "Name");
            myListView.IsGroupingEnabled = true;
            myListView.GroupDisplayBinding = new Binding("Name");
            myListView.GroupShortNameBinding = new Binding("Name");
            //myListView.RowHeight = 100;
            myListView.Header = "这是页眉";
            myListView.Footer = "这是页脚";
            myListView.SeparatorVisibility = SeparatorVisibility.Default;//在windows phone里面默认没有分割线,在android和Ios才有
            myListView.SeparatorColor = Color.Red;
            myListView.ItemTemplate = dataTemplate;
            myListView.ItemsSource = states;
  }
 }
}
 
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
namespace App29
{
    public class City
    {
        public string Name { get; set; }
    }
    public class State : ObservableCollection<City>
    {
        public State(string name)
        {
            Name = name;
        }
        public string Name { get; set; }
    }
}

XF 列表视图分组列表填充的更多相关文章

  1. Apply Grouping to List View Data 将分组应用于列表视图数据

    This lesson will teach you how to apply grouping to List View data. For this purpose, you will group ...

  2. Android 用SQLite 使用 CursorLoader 中的数据填充列表视图

    我做了简单的测试应用程序基于此示例.有一个按钮,插入到数据库和列表视图的数据.都是在 MainActivity 中.在原来的代码是restartLoader() 仅从调用 onResume() ,但它 ...

  3. SharePoint 2013无代码实现列表视图的时间段动态筛选

    本文介绍两种为列表视图设置时间段筛选器的方法.其中,第一个方法用于SharePoint Server,第二个方法同时还能用于SharePoint Foundation. 方法一:日期筛选器Web部件 ...

  4. [WP8.1UI控件编程]SemanticZoom控件实现分组列表

    11.1.5 SemanticZoom实现分组列表 SemanticZoom控件可以让用户实现一种更加高级的列表,这种列表可以对列表的项目进行分组,同时这个SemanticZoom控件会提供两个具有相 ...

  5. Android ExpandableListView BaseExpandableListAdapter (类似QQ分组列表)

    分组列表视图(ExpandableListView) 和ListView不同的是它是一个两级的滚动列表视图,每一个组可以展开,显示一些子项,类似于QQ列表,这些项目来至于ExpandableListA ...

  6. delphi列表视图组件(TListView)使用方法|实例

    TListView 组件以多种形式显示列表的项目,如详细资料.小图标.大图标等形式表示列表中的项目.    列表视图与用TListBox 组件实现的列表框非常相似.不同的是,列表视图可以让用户选择不同 ...

  7. Swift - 使用表格组件(UITableView)实现分组列表

    1,样例说明: (1)列表以分组的形式展示 (2)同时还自定义分区的头部和尾部 (3)点击列表项会弹出消息框显示该项信息. 2,效果图:       3,代码如下: 1 2 3 4 5 6 7 8 9 ...

  8. Change Field Layout and Visibility in a List View 在列表视图中更改字段布局和可见性

    This lesson will guide you through the steps needed to select columns displayed in the List View. Fo ...

  9. SwiftUI - 一起来仿写微信APP之一首页列表视图

    简介 最近在学习 SwiftUI ,我一般都是先去学习界面布局,所以就想着仿写一下经常使用的软件的界面,所以先拿微信开刀.因为不想一次性发太多的内容,所以只好将主题分解,一部分一部分地去讲,接下来我们 ...

随机推荐

  1. Flink执行时之流处理程序生成流图

    流处理程序生成流图 DataStream API所编写的流处理应用程序在生成作业图(JobGraph)并提交给JobManager之前,会预先生成流图(StreamGraph). 什么是流图 流图(S ...

  2. 【Linux】Linux下配置apache - 安装文件夹具体解释

    一,apache安装路径解释 默认安装路径   /var/apache2 # /etc/apache2/ # |-- apache2.conf # | `--  ports.conf # |-- mo ...

  3. thinkphp中如何实现无限级分类?

    thinkphp中如何实现无限级分类? 一.总结 1.数据表设计+递归算法 二.php实现无限级分类实例总结 1.数据库数据如下: 2.任务需求:给一个id,求自己和所有父亲. 3.实现代码如下:th ...

  4. Nginx与真实IP

    配置了Nginx,Tomcat中的Web程序,获得的ip一直是"127.0.0.1",比较纳闷.获得远程ip,已经判断了很多情况,为什么会这样呢? 正解 proxy_set_hea ...

  5. css+html+js实现多级下拉和弹出菜单

    本文将使用css+html+js实现横向菜单.具有多级弹出菜单下拉. 首先我们来看看效果图: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvajkwMzgy ...

  6. Eclipse Che开发Spring Web应用(入门) (二)

    在上篇博客中我们介绍了如何安装Eclipse Che这种浏览器SDK之后,收到了许多开发者的提问,为了方便初学者开发Java web应用,笔者又一步步实践了spring web开发(demo)过程,欢 ...

  7. 【77.39%】【codeforces 734A】Anton and Danik

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

  8. Linux下的正斜杠"/"和"\"的区别

    今天在检查root目录时发现有一个名为"\"的文件,觉得很奇怪,从来没见过,就准备用Vim打开看看,很自然地输入命令查看一下,结果居然打不开. [root@localhost ~] ...

  9. VS2017 安装过程

    2017 安装过程 工欲善其事必先利其器 Visual Studio 2017 正式版官方下载地址:https://www.visualstudio.com/downloads/ 安装vs2017的时 ...

  10. gridview分页

    protected void lnkbtnFrist_Click(object sender, EventArgs e) { //首页 ; this.ReadData(); } protected v ...