Notify Property Changed on a Dictionary

前端 未结 5 1831
余生分开走
余生分开走 2020-12-09 23:11

I have a WPF / XAML form data-bound to a property in a dictionary, similar to this:


<

5条回答
  •  自闭症患者
    2020-12-09 23:41

    You need to have a clear idea of what you're trying to accomplish before you start implementing change notification. If you want the UI to be updated when an object stored in the dictionary with a given key changes, that's one thing. If you want the UI to be updated when a property of the object stored in the dictionary changes, that's another thing entirely.

    In other words, if you want the UI to update when Reservation.Name changes, you need the Reservation object to perform change notification. If you want the UI to update when Seat[2B] is set to a different Reservation, then the dictionary will need to perform change notification.

提交回复
热议问题