Change Notification in MVVM Hierarchies

前端 未结 5 1338
清酒与你
清酒与你 2021-02-01 07:29

Let\'s say in some abstract ViewModel base-class I have a plain-old property as follows:

public Size Size
{
    get { return _size; }
    set
    {
        _size         


        
5条回答
  •  Happy的楠姐
    2021-02-01 07:58

    I recently blogged about this exact problem. I include a [DependsUpon("Size")] attribute with the Rectangle. I REALLY like this approach, because it keeps the dependency knowledge with the code that creates the dependency, not the other way around.

    Take a look: http://houseofbilz.com/archive/2009/11/14/adventures-in-mvvm----dependant-properties-with-inotifypropertychanged.aspx

提交回复
热议问题