Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/runceel/ReactiveProperty
ReactiveProperty provides MVVM and asynchronous support features under Reactive Extensions. Target frameworks are .NET 6+, .NET Framework 4.7.2 and .NET Standard 2.0.
https://github.com/runceel/ReactiveProperty
c-sharp mvvm reactive-extensions reactiveproperty reative rx uwp wpf xamarin xaml
Last synced: 3 months ago
JSON representation
ReactiveProperty provides MVVM and asynchronous support features under Reactive Extensions. Target frameworks are .NET 6+, .NET Framework 4.7.2 and .NET Standard 2.0.
- Host: GitHub
- URL: https://github.com/runceel/ReactiveProperty
- Owner: runceel
- License: mit
- Created: 2014-10-05T02:27:09.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2024-04-05T12:51:10.000Z (7 months ago)
- Last Synced: 2024-04-13T23:54:18.379Z (7 months ago)
- Topics: c-sharp, mvvm, reactive-extensions, reactiveproperty, reative, rx, uwp, wpf, xamarin, xaml
- Language: C#
- Homepage:
- Size: 52.2 MB
- Stars: 870
- Watchers: 55
- Forks: 99
- Open Issues: 3
-
Metadata Files:
- Readme: README-Android.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-dotnet-maui - ReactiveProperty - square)](https://github.com/runceel/ReactiveProperty/stargazers)|[![GitHub last-commit](https://img.shields.io/github/last-commit/runceel/ReactiveProperty?style=flat-square)](https://github.com/runceel/ReactiveProperty/commits) (Plugins)
- awesome-xamarin - ReactiveProperty ★361 - Provides MVVM and asynchronous support features under Reactive Extensions. (Reactive)
README
# ReactiveProperty.XamarinAndroid
ReactiveProperty.XamarinAndroid is MVVM support library for ReactiveProperty + Xamarin.Android environment.- Xamarin is [here](https://xamarin.com/).
# Features
- OneWay and TwoWay databinding, between View's property and ReactiveProperty.
- IList, ObservableCollection and ReadOnlyObservableCollection convert to IListAdapter.
- View classes(ex, Button, TextView...) event provide extension method "EventName"AsObservable.## DataBinding
This ViewModel class is here.
```cs
public class VM
{
// ViewModel Property
public ReactiveProperty Output { get; set; }public VM() { this.Output = new ReactiveProperty(); }
}
```### OneWay databinding.
```cs
var vm = new VM();this.FindViewById(Resource.Id.TextView)
.SetBinding(
x => x.Text, // select target property
vm.Output); // source property
```### TwoWay databinding
```cs
var vm = new VM();this.FindViewById(Resource.Id.EditText)
.SetBinding(
x => x.Text, // select target property
vm.Output, // source property
x => x.TextChangedAsObservable().ToUnit()); // update source trigger
```### Command binding
SetCommand extension methods can be found in IObservable .
```cs
this.FindViewById(Resource.Id.Button)
.ClickAsObservable()
.SetCommand(vm.AlertCommand);
```### Collection binding
Collection type can convert to IListAdapter.
```cs
public class VM
{
public ReadOnlyReactiveCollection Values { get; private set; }
}var vm = new VM();
this.FindViewById(Resource.Id.ListView)
.Adapter = vm.Values.ToAdapter(
(index, value) => LayoutInflator.FromContext(this).Inflate(Android.Resource.Layout.SimpleListItem1) // create view
(index, value, view) => view.FindViewById(Android.Resource.Id.Text1).Text = value, // setup view
(index, value) => value.GetHashCode()); // generate id
```### many many many... extension methods
[here](https://github.com/runceel/ReactiveProperty/blob/vNext/Source/ReactiveProperty.Platform.Android/Extensions/ViewEventExtensions.cs)