zoukankan      html  css  js  c++  java
  • 自定义基类装载数据模块显示到dataGrid

    1 新建一个silverlight应用程序

    2 新建一个Students的类

    类里面定义数据类型

    代码如下

    public class Student
        {
            public string Name { get; set; }
            public string Phone { get; set; }
            public string Address { get; set; }
    
        }
    }
    

     3 在xaml.cs后代代码里面装载数据

    如下

      public void LoadDate() {
                students = new Student[] { new Student{Name = "1", Phone = "1", Address = "1"},
                                           new Student{Name = "2", Phone = "2", Address = "2"},
                                           new Student{Name = "3", Phone = "3", Address = "3"},
                                           new Student{Name = "4", Phone = "4", Address = "4"}
                                  };
            
            }
    

     4拖一个dataGrid的控件到界面上

    修改AutoGenerateColumns="true"

    5

            Student[] students;
            public MainPage()
            {
                InitializeComponent();
                   LoadDate();
                dataGrid1.ItemsSource = students;
               
    
            }
    

     6 效果图

  • 相关阅读:
    滤镜
    android 判断网络是否断开
    U5
    android 界面跳转
    光影魔术手 图片压缩
    服务器绑定 独立ip
    Java 开源 SOCKET 框架
    spring aop ehcache
    呼叫中心
    华丽字体
  • 原文地址:https://www.cnblogs.com/lihaozhou/p/2643456.html
Copyright © 2011-2022 走看看