Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Injects INotifyPropertyChanged code into properties at compile time.
branch: master

This branch is 1 commit ahead of shiftkey:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Icons
IntegrationTests/IntegrationClassLibrary
Lib/WindowsPhone
NotifyPropertyWeaver
NotifyPropertyWeaverMsBuildTask
NotifyPropertyWeaverTests
NotifyPropertyWeaverVsPackage
NotifyPropertyWeaverVsPackageTests
NuGet
Packages/Mono.Cecil.0.9.5.3/lib/net40
Samples
TestAssemblies
Tools
.gitattributes
.gitignore
CommonAssemblyInfo.cs
IntegrationTest.sln
NotifyPropertyWeaver.sln
README.md
Samples.sln
ShouldInclude.vsd
key.snk

README.md

Injects INotifyPropertyChanged code into properties at compile time.

  • No install required
  • No attributes required
  • No references required
  • No base class required
  • Supports .net 3.5, .net 4, .net 4.5, Silverlight 3, Silverlight 4, Silverlight 5 and Windows Phone 7
  • Supports client profile mode

Feel free to ping me on twitter http://twitter.com/SimonCropp

Setup can be simplified by installing the Visual Studio package

Your Code

public class Person : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    public string GivenNames { get; set; }
    public string FamilyName { get; set; }

    public string FullName
    {
        get
        {
            return string.Format("{0} {1}", GivenNames, FamilyName);
        }
    }

}

What gets compiled

public class Person : INotifyPropertyChanged
{

    public event PropertyChangedEventHandler PropertyChanged;

    string givenNames;
    public string GivenNames
    {
        get { return givenNames; }
        set
        {
            if (value != givenNames)
            {
                givenNames = value;
                OnPropertyChanged("GivenNames");
                OnPropertyChanged("FullName");
            }
        }
    }

    string familyName;
    public string FamilyName
    {
        get { return familyName; }
        set 
        {
            if (value != familyName)
            {
                familyName = value;
                OnPropertyChanged("FamilyName");
                OnPropertyChanged("FullName");
            }
        }
    }

    public string FullName
    {
        get
        {
            return string.Format("{0} {1}", GivenNames, FamilyName);
        }
    }

    public virtual void OnPropertyChanged(string propertyName)
    {
        var propertyChanged = PropertyChanged;
        if (propertyChanged != null)
        {
            propertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

WIKI

See Wiki for more doco

Something went wrong with that request. Please try again.