You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
housekeeping: Improve code snippets in readme.md (#1825)
* housekeeping: Improve code snippets in readme.md
* Add RxUI bindings example
* Use OAPH instead of mutable collections
* Reference OAPH and commands guides
<h3>Define under what conditions a network request will be made</h3>
75
75
76
+
We're describing here, in a *declarative way*, the conditions in which the Search command is enabled. Now our Command IsEnabled is perfectly efficient, because we're only updating the UI in the scenario when it should change.
77
+
76
78
```csharp
77
-
// Here we're describing here, in a *declarative way*, the conditions in
78
-
// which the Search command is enabled. Now our Command IsEnabled is
79
-
// perfectly efficient, because we're only updating the UI in the scenario
ReactiveCommand has built-in support for background operations and guarantees that this block will only run exactly once at a time, and that the CanExecute will auto-disable and that property IsExecuting will be set accordingly whilst it is running.
85
+
86
86
```csharp
87
-
// ReactiveCommand has built-in support for background operations and
88
-
// guarantees that this block will only run exactly once at a time, and
89
-
// that the CanExecute will auto-disable and that property IsExecuting will
// ReactiveCommands are themselves IObservables, whose value are the results
98
-
// from the async method, guaranteed to arrive on the UI thread. We're going
99
-
// to take the list of search results that the background operation loaded,
100
-
// and them into our SearchResults.
101
-
Search.Subscribe(results=>
102
-
{
103
-
SearchResults.Clear();
104
-
SearchResults.AddRange(results);
105
-
});
92
+
ReactiveCommands are themselves `IObservables`, whose values are the results from the async method, guaranteed to arrive on the UI thread. We're going to take the list of search results that the background operation loaded, and turn them into our SearchResults property declared as [`ObservableAsPropertyHelper<T>`](https://reactiveui.net/docs/handbook/oaph/#example).
Any exception thrown from the [`ReactiveCommand.CreateFromTask`](https://reactiveui.net/docs/handbook/commands/) gets piped to the `ThrownExceptions` Observable. Subscribing to this allows you to handle errors on the UI thread.
101
+
111
102
```csharp
112
-
// ThrownExceptions is any exception thrown from the CreateAsyncTask piped
113
-
// to this Observable. Subscribing to this allows you to handle errors on
<h3>Binding our ViewModel to the platform-specific UI</h3>
117
+
118
+
ReactiveUI fully supports XAML markup bindings, but we have more to offer. [ReactiveUI Bindings](https://reactiveui.net/docs/handbook/data-binding/) work on **all platforms**, including Xamarin Native and Windows Forms, and operate the same. Those bindings are strongly typed, and renaming a ViewModel property, or a control in the UI layout without updating the binding, the build will fail.
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.
0 commit comments