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. iOS开发runtime学习:一:runtime简介与runtime的消息机制

    一:runtime简介:也是面试必须会回答的部分 二:runtime的消息机制 #import "ViewController.h" #import <objc/messag ...

  2. Delphi 获取Internet缓存文件 -- FindFirstUrlCacheEntry FindNextUrlCacheEntry

    下面是我写的一个函数,把所有的缓存文件路径添加到一个字符串列表中,直接看代码,带了注释.另外还有删除缓存等等大家自己到msdn找找. 需要引用 WinInet // 获取Internet缓存文件 fu ...

  3. js课程 1-5 js如何测试变量的数据类型

    js课程 1-5 js如何测试变量的数据类型 一.总结 一句话总结:用typeof()方法. 1.js如何判断变量的数据类型? 用typeof()方法. 13 v=10; 14 15 if(typeo ...

  4. [React Native] Animate Styles of a React Native View with Animated.timing

    In this lesson we will use Animated.timing to animate the opacity and height of a View in our React ...

  5. 【codeforces 757B】 Bash's Big Day

    time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard o ...

  6. 【codeforces 760C】Pavel and barbecue

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  7. erlang数字转字符串

    http://fengmm521.blog.163.com/blog/static/2509135820147922355273/ 如果有一个数字,你想要转换成字符串这个在Erlang中是怎么操作的, ...

  8. Using Eredis, Redis With Erlang

    http://no-fucking-idea.com/blog/2012/03/23/using-eredis-in-erlang/ Using Eredis, Redis With Erlang M ...

  9. for循环中setTimeout,var与let的不同

    先看下面两段代码 for (let i = 0; i < 5; i++) { setTimeout(function () { console.log(i) }, 2000) } for (va ...

  10. 云主机启动Node服务后,关闭控制台,无法访问的问题

    之前一直用node app.js操作,开启服务后,关闭控制台,仍然可以正常访问我的网站.但昨晚新买腾讯云的服务器后,发现关闭控制台后,就无法访问网站了.然后给腾讯云发了个工单.腾讯云的工程师给了一篇技 ...