Jan 4, 2018

WPF Error 40 BindingExpression path error: property not found on 'object'

On XAML, I created a datatemplate with binding for an object called Skills.
And I set the datatemplate in my C# program on a ListViewItem like this:

DataTemplate template = (DataTemplate)this.FindResource("SkillListItem");
ListViewItem litem = new ListViewItem();
litem.ContentTemplate = template; 

And on visual studio I got this error:
WPF Error 40 BindingExpression path error: 'Name 'property not found on 'object' Skill

It is a strange error that can solve by changing
public string Name;
 
to this
public string Name{ get; set; }


 

No comments:

Post a Comment

Followers