Why Does Binding to a Struct Not Work?

前端 未结 4 637
暖寄归人
暖寄归人 2020-12-06 05:22

I\'ve recently encountered an issue where I have an ObservableCollection bound to a ListView. People is a structure which I have written. So long as I set the value(s) of

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 06:16

    Your binding gets a copy of struct since structs are passed by value to methods. If the binding updates something; a copy in memory somewhere is being modified and hence the original object of yours is not updated.

提交回复
热议问题