zoukankan      html  css  js  c++  java
  • XF 列表视图分组列表填充

    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; }
        }
    }
  • 相关阅读:
    Tarjan算法求双连通分量
    Tarjan
    前端技术实现js图片水印
    记录一下ionic canvas图片,还有canvas里面的图片跨域的问题
    ionic cordova screenshot 使用和操作
    关于ionic2 更新到ionic3 后组件不能用的解决方案
    背景图处理,这是个好东西记录一下
    radio样式的写法,单选和多选如何快速的改变默认样式,纯CSS,
    ionic使用cordova插件中的Screenshot截图分享功能
    ionic中执行pop返回上一个页面,还需要执行操作
  • 原文地址:https://www.cnblogs.com/dxmfans/p/9439305.html
Copyright © 2011-2022 走看看