File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -107,13 +107,28 @@ public string Name
107
107
108
108
### ` AsyncRelayComand<T> `
109
109
Reusable generic command class that encapsulates ` ICommand ` and allows asynchronous execution.
110
- When used with a ` Binding ` the command will execute asynchronously when an awaitable execute handler is assigned to the command.
110
+ When used with a ` Binding ` , the command will always execute asynchronously as long as an awaitable execute handler is assigned to the command.
111
111
112
112
#### Example
113
113
114
+ Declare ` ICommand `
115
+
114
116
``` c#
115
117
// ICommand property
116
118
public IAsyncRelayCommand < string > StringAsyncCommand => new AsyncRelayCommand <string >(ProcessStringAsync );
119
+ ```
120
+ Execute XAML:
121
+
122
+ ``` XAML
123
+
124
+ <!-- Executes asynchronously, because an awaitable delegate was registered with the IAsyncRelayCommand -->
125
+ <Button Command =" {Binding StringAsyncCommand}" />
126
+
127
+ ```
128
+
129
+ Execute C#
130
+
131
+ ``` C#
117
132
118
133
// Execute asynchronously
119
134
await StringAsyncCommand .ExecuteAsync (" String value" );
You can’t perform that action at this time.
0 commit comments