File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -105,36 +105,36 @@ public string Name
105
105
```
106
106
----
107
107
108
- ### ` AsyncRelayComand<T > `
108
+ ### ` AsyncRelayComand<TCommandParam > `
109
109
Reusable generic command class that encapsulates ` ICommand ` and allows asynchronous execution.
110
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 `
114
+ Declare async ` ICommand ` :
115
115
116
116
``` c#
117
- // ICommand property
118
- public IAsyncRelayCommand < string > StringAsyncCommand => new AsyncRelayCommand <string >(ProcessStringAsync );
117
+ // ICommand. The command delegate 'Task ProcessStringAsync(string)' returns a 'Task' object and is awaitable.
118
+ public IAsyncRelayCommand < string > SomeAsyncCommand => new AsyncRelayCommand <string >(ProcessStringAsync );
119
119
```
120
120
Execute XAML:
121
121
122
122
``` XAML
123
123
124
124
<!-- Executes asynchronously, because an awaitable delegate was registered with the IAsyncRelayCommand -->
125
- <Button Command =" {Binding StringAsyncCommand }" />
125
+ <Button Command =" {Binding SomeAsyncCommand }" />
126
126
127
127
```
128
128
129
- Execute C#
129
+ Execute C#:
130
130
131
131
``` C#
132
132
133
133
// Execute asynchronously
134
- await StringAsyncCommand .ExecuteAsync (" String value" );
134
+ await this . SomeAsyncCommand .ExecuteAsync (" String value" );
135
135
136
136
// Execute synchronously
137
- StringAsyncCommand .Execute (" String value" );
137
+ this . SomeAsyncCommand .Execute (" String value" );
138
138
139
139
```
140
140
You can’t perform that action at this time.
0 commit comments