Last active
August 1, 2023 21:56
-
-
Save worldbeater/d18b13811abddf2ced0085cc4ba1d85e to your computer and use it in GitHub Desktop.
Assembly Weaving. ReactiveUI.Fody. See: https://medium.com/@worldbeater/reactive-mvvm-for-net-platform-175dc69cfc82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AddINotifyPropertyChangedInterface] | |
public class FodyReactiveViewModel | |
{ | |
public ReactiveCommand<Unit, Unit> Clear { get; } | |
public string Greeting { get; private set; } | |
public string Name { get; set; } = string.Empty; | |
public FodyReactiveViewModel() | |
{ | |
Clear = ReactiveCommand.Create(() => { Name = string.Empty; }); | |
this.WhenAnyValue(x => x.Name) | |
.Select(name => $"Hello, {name}!") | |
.Subscribe(x => Greeting = x); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment