I have a SQL Server table with some associated tables. I need to be able to do CRUD using Entity Framework with the main table in a WPF DataGrid with Combo Boxes for the fields that are associated with another table. This is a very simple program so I do not want to use MVVM with it, maybe later.
So let us say I want a program similar to what is described in
ComboBox in DataGrid in WPF, except the data is in a SQL Server table that I want to use
Entity Framework with. I have found
Entity Framework Databinding with WPF, but it is a little confusing, it attempts to say too much.
We can use the following entity design for the purposes of this discussion:

I need for the Status Name and User Name to be shown in Combo Boxes in a DataGrid for Tickers instead of StatusId and UserId.
Akhil GargPosted Mar 29, 2015, 12:51 AM
Sam HobbsPosted Mar 30, 2015, 4:53 PM
See Simple CRUD using WPF and the EF simply. The thing I was loking for is that we can create a Data Source. That makes things easier by generating most of the necessary code.
Sam HobbsPosted Mar 29, 2015, 3:59 AM
Note that to create an ObservableCollection
Akhil GargPosted Mar 29, 2015, 2:50 AM
Sam HobbsPosted Mar 29, 2015, 2:44 AM
Probably deep within the MVVM code it is doing something more. If I try to make the program simple and not use MVVM or MVC or something like
Akhil GargPosted Mar 29, 2015, 2:19 AM
Sam HobbsPosted Mar 29, 2015, 2:06 AM
Okay, I added "Mode=TwoWay" for one of my DataGridTextColumns. When I tested it, I immediately got the error "A TwoWay or OneWayToSource binding cannot work on the read-only property 'Subject'". So there is more that needs to be done than just setting the mode to TwoWay.
Sam HobbsPosted Mar 28, 2015, 1:32 PM
I changed:
DataGrid1.DataContext = t;To:
And now I am getting the specified columns. It also works without the ItemsSource attribute of the DataGrid tag in the XAML.However my understanding is that ItemsSource is one-way. I need two-way so I assume I need to use DataContext.
Sam HobbsPosted Mar 28, 2015, 4:59 AM
Sam HobbsPosted Mar 28, 2015, 4:54 AM
Let's say I have the following in my Window_Loaded:
And I have the following XAML:
Using that I get:
Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported.
Perhaps if I can get past that I can make progress proceeding further.
Sam HobbsPosted Mar 21, 2015, 12:07 AM
Thank you for your reply. I will study it
Afzaal Ahmad ZeeshanPosted Mar 20, 2015, 11:28 PM
Binding in WPF is not related to (or bound to) Entity framework in any way, it just defines a mechanism for you to bind your view controls to your model data; think of them as simple classes. In WPF, you can bind your controls with a dynamically generated data (such as anonymous objects) or, you can bind the controls with some StaticResource; providing a key to it.
So now leaving that (broad and really very wide) chapter of Binding in WPF or Entity framework. What you're having right now, is a scenario to represent the data inside your Model. Now what happens in the back-end of Entity framework is, that it provides you with the basic CRUD operations, and inside the READ function, it shows you with the Id, then Name and a link to other functions and so on and so forth. You can override it.
Inside your WPF syntax, you can write the Binding to load the data from your collection (of Model) and then show it using Binding. In that article that you've shown, author has shown you with an example of adding the resource as the StaticResource, as the ItemsSource. ItemsSource is the actual collection upon which the binding is performed, which attributes are to be used from this collection are expressed as XAML notation, as, {Binding PropertyName}.
So as you've said, you wanted to get the Status.Name being shown, you can pass this name (while creating the Binding) to the XAML sytanx... Which will then be left to the WPF framework, and you will see that the Status.Name would be tied to the View (make sure, you're having a template like he had to bind the Model to the View). WPF would load all of the objects inside the collection of Model, then it would tie that collection to the View, and set the values of the properties required to the View... Letting you see what you wanted to see.
I would try to write an article covering all of the basic components of Binding in WPF, and what some-what factors of Entity framework (CRUD operations) can be established manually. I wish I have made something clear, not messy. ;)