码迷,mamicode.com
首页 > Windows程序 > 详细

【C#】使用ADO .Net Entities Framework 与WPF ListBox控件绑定

时间:2016-01-17 00:01:48      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:c#   listbox   ado .net entities framework   

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;


namespace WpfApplication68

{

    /// <summary>

    /// Interaction logic for MainWindow.xaml

    /// </summary>

    public partial class MainWindow : Window

    {

        public MainWindow()

        {

            InitializeComponent();

            BooksEntities booksEntities = new BooksEntities();

            var test = from r in booksEntities.Books

                       select r;

            foreach(var item in test)

            {

                listBox.Items.Add(item.Title);

            }

            

        }

    }

}


【C#】使用ADO .Net Entities Framework 与WPF ListBox控件绑定

标签:c#   listbox   ado .net entities framework   

原文地址:http://acadia627.blog.51cto.com/3992605/1735634

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!