• wpf dataGrid 简单数据绑定


    数据实体类:
    [Table(Name = "customers")]
        public class Customer
        {
     
            private string _CustomerID;
            [Column(IsPrimaryKey=true,Storage="_CustomerID")]
            public string CustomerID
            {
                get
                {
                    return this._CustomerID;www.wpf123.com
                }
                set
                {
                    this._CustomerID = value;
                }
            }
     
            private string _City;
            [Column(Storage = "_City")]
            public string City
            {
                get
                {
                    return this._City;
                }
                set
                {
                    this._City = value;
                }
            }
     
            private string _CompanyName;
            [Column(Storage = "_CompanyName")]
            public string CompanyName
            {
                get
                {
                    return this._CompanyName;
                }
                set
                {
                    this._CompanyName = value;
                }
            }

    dataGrid数据绑定:
    System.Data.Linq.DataContext db = new DataContext("Data Source=.;Initial Catalog=northwind;Integrated Security=True");
                Table<Customer> customers = db.GetTable<Customer>();
     
                IQueryable<Customer> custQuery =
                    from cust in customers
                    where cust.City == "London"
                    select cust;
                dataGrid1.ItemsSource = custQuery.ToList();

    http://www.wpf123.com/news/?185.html 

  • 相关阅读:
    Linux:Day7(上) find、文件特殊权限、if语句
    Linux:Day6(下) vim编辑器
    Linux:Day6(上) egrep、条件测试
    Linux:Day5 shell编程初步、grep
    Linux:Day4(下) 用户及组管理
    Linux中的cat、more、less、head、tail命令
    ajax中的contendType和dataType知识点梳理
    Django使用jsonp和cors解决跨域请求问题
    Django的Modelforms的介绍
    Django的Rbac介绍3
  • 原文地址:https://www.cnblogs.com/wpf123/p/2052872.html
Copyright © 2020-2023  润新知