WPF two-way binding not working

后端 未结 4 1023
迷失自我
迷失自我 2020-12-16 15:30

I have a data context (UserPreferences) assigned to my main window, and a textbox that binds two-way to a property within one of the data context\'s properties

4条回答
  •  旧巷少年郎
    2020-12-16 15:54

    I had the same issue. My problem was binding property name was wrong. If you look at the output window you can see all the binding errors during runtime.

    System.Windows.Data Error: 40 : BindingExpression path error: 'SelectedProtectedWebsiteTemplate' property not found on 'object' ''ProtectedWebsitesViewModel' (HashCode=32764015)'. BindingExpression:Path=SelectedProtectedWebsiteTemplate.Name; DataItem='ProtectedWebsitesViewModel' (HashCode=32764015); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')

提交回复
热议问题