Click here to Skip to main content
15,916,452 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am new to WPF and Entity Framework.I have an entity called Users. I want to bindn the contents of the Users Entity to the wpf datagrid. Can anyone please help me on this issue.
Thanks
Posted

Are you looking for this, where 'Your_Entities' is your entity Name and 'Users' is the name of the table.

C#
Your_Entities context = new Your_Entities();

    private void simpleButton1_Click(object sender, EventArgs e)
    {
        var query = from c in context.Users
                    where c.UserName == "James"
                    select new { c.UserName, c.Password, c.Description };

        var results = query.ToList();

        gridControl1.DataSource = results;
    }
 
Share this answer
 
Comments
Iuliia Ashomok 9-Apr-15 5:05am    
Nice topic. Works 100%.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900