How to bind an ItemsSource to a private property

前端 未结 4 1152
情书的邮戳
情书的邮戳 2021-01-11 19:25

How to bind WPF an ItemsSource to a private property?



        
4条回答
  •  伪装坚强ぢ
    2021-01-11 20:11

    DataBinding in WPF works only with public properties.

    MSDN:

    The properties you use as binding source properties for a binding must be public properties of your class. Explicitly defined interface properties cannot be accessed for binding purposes, nor can protected, private, internal, or virtual properties that have no base implementation

提交回复
热议问题