Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="https://stackoverflow.com/questions/4716400/simplest-way-to-achieve-automatic-notification-of-property-change/4717466#4717466">Simon's answer</a> is the solution, but here's my code and a screenshot for reference. I am using Prism (with MEF - ignore the attributes on the class), so I inherit from NotificationObject for INotifyPropertyChanged. (It defines a <code>RaisePropertyChanged</code> method, so you have to tell NotifyPropertyWeaver that in your project file.)</p> <h2>The Class</h2> <pre><code>using System.ComponentModel.Composition; using Microsoft.Practices.Prism.ViewModel; [Export] [PartCreationPolicy(CreationPolicy.NonShared)] public class SignControllerViewModel : NotificationObject { public string Uri { get; set; } } </code></pre> <h2>The Project File</h2> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; &lt;!-- snipped --&gt; &lt;UsingTask TaskName="NotifyPropertyWeaverMsBuildTask.WeavingTask" AssemblyFile="$(SolutionDir)lib\NotifyPropertyWeaverMsBuildTask.dll" /&gt; &lt;Target Name="AfterBuild"&gt; &lt;NotifyPropertyWeaverMsBuildTask.WeavingTask TargetPath="$(TargetPath)" TryToWeaveAllTypes="true" EventInvokerName="RaisePropertyChanged" MessageImportance="High"/&gt; &lt;/Target&gt; &lt;/Project&gt; </code></pre> <h2>The Reflector Code</h2> <p><img src="https://i.stack.imgur.com/Ka3Jd.png" alt="Code after INPC has been weaved into it."></p>
    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. 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