Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

housekeeping: Add ReactiveUI.Fody usage example #1846

Merged
merged 1 commit into from Nov 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Expand Up @@ -129,6 +129,32 @@ this.WhenActivated(cleanup =>
});
```

<h3>Forget about INotifyPropertyChanged boilerplate code</h3>

[ReactiveUI.Fody](https://www.nuget.org/packages/ReactiveUI.Fody/) package allows you to decorate read-write properties with `Reactive` attribute — and code responsible for property change notifications will get injected into your property setters automatically at compile time. We use [Fody](https://github.com/Fody/Fody) tooling to make this magic work.

```csharp
public class ManagedViewModel : ReactiveObject
{
// This reactive property will notify the UI when it changes.
[Reactive] public string SearchQuery { get; set; }
}
```

The code above gets compiled into the following code:

```csharp
public class CompiledViewModel : ReactiveObject
{
private string searchQuery;
public string SearchQuery
{
get => searchQuery;
set => this.RaiseAndSetIfChanged(ref searchQuery, value);
}
}
```

<h2>Support</h2>

If you have a question, please see if any discussions in our [GitHub issues](github.com/reactiveui/ReactiveUI/issues) or [Stack Overflow](https://stackoverflow.com/questions/tagged/reactiveui) have already answered it.
Expand Down