zoukankan      html  css  js  c++  java
  • 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 

  • 相关阅读:
    技术晨读_20160611
    浏览器退出之后php还会继续执行么?
    大话keepalive
    也说说TIME_WAIT状态
    PHP的错误机制总结
    ASP.NET MVC中使用Unity Ioc Container
    Unity依赖注入使用详解
    小菜学习设计模式(五)—控制反转(Ioc)
    程序员的人性思考(续)
    Delegate、Predicate、Action和Func
  • 原文地址:https://www.cnblogs.com/zhangtao/p/2046949.html
Copyright © 2011-2022 走看看