Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you are looking for has been solved in the concept of Aspect Oriented Programming (AOP).</p> <p>One example is <a href="http://www.sharpcrafters.com/solutions#ui" rel="nofollow">in PostSharp</a>, (Also, <a href="http://www.sharpcrafters.com/solutions/notifypropertychanged" rel="nofollow">see details here</a>) which lets you write your data/viewmodel classes like this:</p> <pre><code>[NotifyPropertyChanged] public class Shape { public double X { get; set; } public double Y { get; set; } } public class Rectangle : Shape { public double Width { get; set; } public double Height { get; set; } } </code></pre> <p>If you don't like PostSharp, I'm sure the other AOP frameworks out there has similar functionality.</p> <p><strong>EDIT</strong></p> <p>I just found <a href="http://code.google.com/p/notifypropertyweaver/" rel="nofollow">NotifyPropertyWeaver</a> which does this for you without requiring a full AOP framework. </p> <p>It uses the Mono.Cecil stuff to inject notification code during compilation and is installable either through NuGet (this is what I did) or from the project web site.</p> <p>By default, it doesn't even require attributes, (it automatically figures out which properties and classes need change notification) but you can be explicit also, like so:</p> <pre><code>[NotifyProperty] public int FooBar { get; set; } </code></pre> <p>One nice feature I found in it was the possibility to declare dependencies between properties. In this case, <code>RaisePropertyChanged("FoobarTimesTwo")</code> will be called whenever FooBar changes.</p> <pre><code>[DependsOn("FooBar")] public int FoobarTimesTwo { get { return FooBar * 2; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload