How do I fix “Two-way binding requires Path or XPath” exception in WPF Datagrids?

Ok, well, having typed all that in, I tried something which worked. I am posting anyway, in case it helps others.

Up vote 0 down vote favorite share g+ share fb share tw.

Background/context for this question: I have a WPF desktop application. It uses LINQ to SQL to connect to its SQL database, and it displays its data in WPF Datagrids. It was working fairly well, but performance was a problem because LINQ can be deadly slow, so I have been switching my logic and UI controls away from LINQ database contexts as much as possible, and instead loading them into local variables which are very similar to the LINQ objects, which massively improves performance.

The problem: As I test my Datagrids, I am now getting a new exception "Two-way binding requires Path or XPath. " when I try to edit the value in a certain (integer) column of one Datagrid, though editing string columns had been working fine. I don't understand why I am getting this, or what to do about it.

So it worked when the datagrid. Datacontext was set to a LINQ entity association, but it only almost works when it is set to a list of plain objects. I tried changing the list to an ObservableCollection, but this had no apparent effect.

I have looked at about a dozen different related questions here and on other sites, and am not seeing anything that seems to help. Currently I have: ... which is bound by the code: dgDays. DataContext = TheMember.

RAM_Member_Requirements_Days; which is defined as: public ObservableCollection RAM_Member_Requirements_Days = new ObservableCollection(); whose bound members are: public class RAM_Member_Requirements_Day : INotifyPropertyChanged { // RAM equivalents of DB values: public System. Nullable Protein; public System. Nullable Carb; public System.

Nullable Fat; public System. Nullable ProteinPercent; public System. Nullable CarbPercent; public System.

Nullable FatPercent; public System. Nullable NonPFWMeals; public System. Nullable Skip; public System.

Nullable SkipDate; I found a very simple fix shortly after typing this, which I'll post when the site lets me after its 8-hour delay. Wpf data-binding wpfdatagrid 2-way-object-databinding link|improve this question edited Feb 26 at 1:25 asked Feb 26 at 1:19Dronz899 83% accept rate.

Ok, well, having typed all that in, I tried something which worked. I am posting anyway, in case it helps others. The solution was to add to the problem member variables that are bound: { get; set; } As in: public System.

Nullable Protein { get; set; } public System. Nullable Carb { get; set; } public System. Nullable Fat { get; set; } public System.

Nullable ProteinPercent { get; set; } public System. Nullable CarbPercent { get; set; } public System. Nullable FatPercent { get; set; } public System.

Nullable NonPFWMeals { get; set; } public System. Nullable Skip { get; set; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions