RaiseChangeGenerator 1.1.11

dotnet add package RaiseChangeGenerator --version 1.1.11
                    
NuGet\Install-Package RaiseChangeGenerator -Version 1.1.11
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RaiseChangeGenerator" Version="1.1.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RaiseChangeGenerator" Version="1.1.11" />
                    
Directory.Packages.props
<PackageReference Include="RaiseChangeGenerator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RaiseChangeGenerator --version 1.1.11
                    
#r "nuget: RaiseChangeGenerator, 1.1.11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RaiseChangeGenerator@1.1.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RaiseChangeGenerator&version=1.1.11
                    
Install as a Cake Addin
#tool nuget:?package=RaiseChangeGenerator&version=1.1.11
                    
Install as a Cake Tool

RaiseChangeGenerator

RaiseChangeGenerator is a C# source generator that automatically implements RaisePropertyChanged for your (optionally proxied) properties, reducing boilerplate and making ViewModels cleaner and easier to maintain.

Features

  • Generates public getter/setter, with this.RaisePropertyChanged() for the setter
  • Supports:
    • Regular properties
      [RaiseChange]
      private string _myProperty;
      
    • Proxy properties (and multiple properties, with a custom name if desired)
      [RaiseChangeProxy(nameof(TorrentInfo.Name))]
      [RaiseChangeProxy(nameof(TorrentInfo.Size), "Bytes")]
      private TorrentInfo _torrentInfo;
      
    • Dependent property
      [RaiseChange]
      [AlsoNotify(nameof(FullName))]
      private string _firstName;
      

[RaiseChange]/[RaiseChangeProxy] attribute

  • The class needs the partial keyword to allow the generator to add the necessary code.
  • The class must inherit from ReactiveObject (in Avalonia projects this often happpens indirectly through ViewModelBase).

Your IDE should warn you if you forget partial and there's a custom error message if you forget to inherit from ReactiveObject - but it's easy to miss due to a flood of missing property errors.

[RaiseChange]

For simple auto-properties, create the backing field (e.g., _myProperty) and decorate it with the [RaiseChange] attribute. The generator will create a public property (MyProperty) with getter and setter, and the setter will raise the PropertyChanged event.

public partial class MyViewModel : ViewModelBase
{
    [RaiseChange]
    private string _myProperty;
}
/* Automatic Generation will create a `public string MyProperty` property.
** The name is the CamelCase version of the variable name (_myProperty in this case).
** The setter will `this.RaisePropertyChanged(nameof(MyProperty))` (if it changed) */

[RaiseChangeProxy]

For proxy properties, you can use the [RaiseChangeProxy] attribute. This is useful when you want to wrap another object and notify changes on it. Typically used for a Model from qBittorrentClient in this project.

It expects at least one parameter, the name of the property on the wrapped object that you want to notify changes for.

I <u>highly</u> recommend using the nameof operator to avoid typos and making refactoring easier.

public partial class MyViewModel : ViewModelBase
{
    [[RaiseChangeProxy](nameof(TorrentInfo.Name))]
    [[RaiseChangeProxy](nameof(TorrentInfo.Size), "Bytes")]
    private TorrentInfo _torrentInfo;
}
/* Similarly to the previous example (public) getter and setters for the backing fields will 
** be generated automatically with the setter triggering RaisePropertyChanged.
** For ProxyProperties the name of the proxied property is used,
** unless you assigned a name as per the second decorator above.
** Although name customization is an option I would recommend using it,
** tools used for refactoring are unlikely to figure out what to do with a string.*/

AlsoNotify

The AlsoNotify attribute allows you to notify additional properties when a field changes. This is useful for computed properties that depend on other properties.

I <u>highly</u> recommend using the nameof operator to avoid typos and making refactoring easier.

public partial class MyViewModel : ViewModelBase
{
    [RaiseChange]
    [AlsoNotify(nameof(FullName))]
    [AlsoNotify(nameof(InitialsWithName))]
    private string _firstName;

    [RaiseChange]
    [AlsoNotify(nameof(FullName))]
    [AlsoNotify(nameof(InitialsWithName))]
    private string _lastName;

    // Computed properties that depend on FirstName and LastName
    public string FullName => $"{FirstName} {LastName}";
    public string InitialsWithName => $"{FirstName[0]}{LastName[0]} - {FullName}";
}
/* When FirstName or LastName changes, the setter will automatically call:
** - this.RaisePropertyChanged(nameof(FirstName)) or this.RaisePropertyChanged(nameof(LastName))
** - this.RaisePropertyChanged(nameof(FullName))
** - this.RaisePropertyChanged(nameof(InitialsWithName))
** This ensures the UI (and other observers) update all dependent properties. */
Using AlsoNotify with Proxy Properties

You can also use AlsoNotify with proxy properties:

public partial class TorrentViewModel : ViewModelBase
{
    [RaiseChangeProxy(nameof(TorrentInfo.Downloaded))]
    [RaiseChangeProxy(nameof(TorrentInfo.Size))]
    [AlsoNotify(nameof(ProgressPercentage))]
    [AlsoNotify(nameof(RemainingBytes))]
    private TorrentInfo _torrentInfo;

    // Computed properties based on the proxy properties
    public double ProgressPercentage => Size > 0 ? (Downloaded / (double)Size) * 100 : 0;
    public long RemainingBytes => Size - Downloaded;
}
/* When Downloaded or Size changes through the proxy properties,
** both ProgressPercentage and RemainingBytes will be notified to update. */

Example: Complete ViewModel

Here's a complete example showing all features together:

public partial class PersonViewModel : ViewModelBase
{
    // Simple property
    [RaiseChange]
    private int _age;

    // Properties with dependent notifications
    [RaiseChange]
    [AlsoNotify(nameof(FullName))]
    [AlsoNotify(nameof(DisplayText))]
    private string _firstName;

    [RaiseChange]
    [AlsoNotify(nameof(FullName))]
    [AlsoNotify(nameof(DisplayText))]
    private string _lastName;

    // Proxy properties with dependent notifications
    [RaiseChangeProxy(nameof(Address.Street))]
    [RaiseChangeProxy(nameof(Address.City))]
    [RaiseChangeProxy(nameof(Address.ZipCode))]
    [AlsoNotify(nameof(FullAddress))]
    private Address _address;

    // Computed properties
    public string FullName => $"{FirstName} {LastName}";
    public string DisplayText => $"{FullName} (Age: {Age})";
    public string FullAddress => $"{Street}, {City} {ZipCode}";
}

Troubleshooting

Nullable Warning (CS8669)

If you see warnings stating The annotation for nullable reference types should only be used in code within a '#nullable' annotations context, ensure:

  1. Your project has <Nullable>enable</Nullable> in the .csproj.
  2. Your ViewModels are marked as partial.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.11 119 3/9/2026
1.1.10 105 3/9/2026
1.1.9 102 3/9/2026
1.1.8 103 3/9/2026
1.1.7 101 3/9/2026
1.1.6 101 3/9/2026
1.1.5 103 3/9/2026
1.1.4 105 3/9/2026
1.1.3 104 3/9/2026
1.1.2 293 12/17/2025
1.1.1 286 12/16/2025
1.1.0 290 12/16/2025
1.0.3 289 12/16/2025
1.0.2 286 12/16/2025
1.0.1 287 12/16/2025
1.0.0 291 12/16/2025