Julie Lerman Blog - Binding EF data to the (free) Xceed WPF Data Grid
"I thought I would give the Xceed WPF DataGrid (it's free!) a whirl with Entity Framework databinding. So far I have only explored the basics - no anonymous types or sprocs and I am only working with a READ-ONLY scenario. (I did notice something in their docs about being able to modify and delete but not add when binding to LINQ to SQL queries.) I have, however, at least used a multi-level object graph.
Here's what I've come up with.
Add the grid
- Drop an Xceed WPF DataGrid on a WPF Window
Preparing the data
- I created an EDM from AdventureWOrksLT. The namespace is awModel and the EntityContainer is awEntities. I also fixed up some naming, plurazing the EntitySets and the navigation properties that point to collections. (This is my standard routine when creating EDMs)
- In the Loaded event for the WIndow, add the following
Dim aw = New awModel.awEntities
Me.DataGridControl1.ItemsSource = From ord In aw.SalesOrderHeaders.Include("Customer") _
Select ord
..."
An interesting example of using WPF, Databinding and the coming Entity Framework...
So much to learn... :)
Related Past Post XRef:
Xceed DataGrid for WPF 1.1 Released
Free Xceed DataGrid for WPF Now Available for Download
Free WPF DataGrid from XCEED (Coming Soon)
No comments:
Post a Comment
NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...
ALL comments are moderated. I will review every comment before it will appear on the blog.
Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...
I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...
Please see my comment policy for more information if you are interested.
Thanks,
Greg
PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...