Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kswoll/ReactiveUI.Fody
C# Fody extension to generate RaisePropertyChange notifications for properties and ObservableAsPropertyHelper properties.
https://github.com/kswoll/ReactiveUI.Fody
Last synced: 3 months ago
JSON representation
C# Fody extension to generate RaisePropertyChange notifications for properties and ObservableAsPropertyHelper properties.
- Host: GitHub
- URL: https://github.com/kswoll/ReactiveUI.Fody
- Owner: kswoll
- License: mit
- Created: 2015-03-30T18:18:59.000Z (over 9 years ago)
- Default Branch: rxui7beta
- Last Pushed: 2022-03-02T16:28:07.000Z (over 2 years ago)
- Last Synced: 2024-06-30T08:22:26.204Z (4 months ago)
- Language: C#
- Size: 582 KB
- Stars: 152
- Watchers: 17
- Forks: 30
- Open Issues: 15
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xamarin - ReactiveUI.Fody ★105 - Generate RaisePropertyChange notifications for properties and ObservableAsPropertyHelper properties. (Fody)
README
# ReactiveUI.Fody
[![Windows Build Status]](https://ci.appveyor.com/project/KirkWoll/reactiveui-fody)
C# Fody extension to generate RaisePropertyChange notifications for properties and ObservableAsPropertyHelper properties.
## Install ##
Nuget package ReactiveUI.Fody:> Install-Package ReactiveUI.Fody
Currently, you need to manually add `` to your Fody weavers configuration. If this is your first Fody plugin then `FodyWeavers.xml` should look like this after the change:
##Reactive Properties##
Eases the need for boilerplate in your view models when using [reactiveui](https://github.com/reactiveui/ReactiveUI). Typically, in your view models you must declare properties like this:
string _SearchId;
public string SearchId
{
get { return _SearchId; }
set { this.RaiseAndSetIfChanged(ref _SearchId, value); }
}This is tedious since all you'd like to do is declare properties as normal:
[Reactive]public string SearchId { get; set; }
If a property is annotated with the `[Reactive]` attribute, the plugin will weave the boilerplate into your
output based on the simple auto-property declaration you provide.##ObservableAsPropertyHelper Properties
Similarly, in order to handle observable property helper properties, you must declare them like this:
ObservableAsPropertyHelper _PersonInfo;
public string PersonInfo
{
get { return _PersonInfo.Value; }
}Then elsewhere you'd set it up via:
...
.ToProperty(this, x => x.PersonInfo, out _PersonInfo);This plugin will instead allow you to declare the property like:
public extern string PersonInfo { [ObservableAsProperty]get; }
It will generate the field and implement the property for you. Because there is no field for you to pass to
`.ToProperty`, you should use the `.ToPropertyEx` extension method provided by this library:...
.ToPropertyEx(this, x => x.PersonInfo);
This extension will assign the auto-generated field for you rather than relying on the `out` parameter.[Windows Build Status]: https://ci.appveyor.com/api/projects/status/github/kswoll/ReactiveUI.Fody?svg=true