Skip to content

Commit c79d66f

Browse files
authored
Improve ICommand docs (#7721)
1 parent 0b91d0d commit c79d66f

File tree

6 files changed

+208
-209
lines changed

6 files changed

+208
-209
lines changed

xml/System.Windows.Input/ICommand.xml

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -83,42 +83,42 @@
8383
<Docs>
8484
<summary>Defines a command.</summary>
8585
<remarks>
86-
<format type="text/markdown"><![CDATA[
87-
88-
## Remarks
89-
<xref:System.Windows.Input.RoutedCommand> and <xref:System.Windows.Input.RoutedUICommand> are two implementations of the <xref:System.Windows.Input.ICommand> interface in Windows Presentation Foundation (WPF).
90-
91-
## ICommand in Windows Runtime apps
92-
The <xref:System.Windows.Input.ICommand> interface is the code contract for commands that are written in .NET for Windows Runtime apps. These commands provide the commanding behavior for UI elements such as a Windows Runtime XAML `Button` and in particular an `AppBarButton`. If you're defining commands for Windows Runtime apps you use basically the same techniques you'd use for defining commands for a .NET app. Implement the command by defining a class that implements <xref:System.Windows.Input.ICommand> and specifically implement the <xref:System.Windows.Input.ICommand.Execute%2A> method.
93-
94-
XAML for Windows Runtime does not support x`:Static`, so don't attempt to use the `x:Static` markup extension if the command is used from Windows Runtime XAML. Also, the Windows Runtime does not have any predefined command libraries, so the XAML syntax shown here doesn't really apply for the case where you're implementing the interface and defining the command for Windows Runtime usage.
95-
96-
<a name="xamlTextUsage_ICommand"></a>
97-
## XAML Attribute Usage
98-
\<*object property*="*predefinedCommandName*"/>
99-
86+
<format type="text/markdown"><![CDATA[
87+
88+
## Remarks
89+
90+
<xref:System.Windows.Input.RoutedCommand> and <xref:System.Windows.Input.RoutedUICommand> are two implementations of the <xref:System.Windows.Input.ICommand> interface in Windows Presentation Foundation (WPF).
91+
92+
## ICommand in Windows Runtime apps
93+
94+
The <xref:System.Windows.Input.ICommand> interface is the code contract for commands that are written in .NET for Windows Runtime apps. These commands provide the commanding behavior for UI elements such as a Windows Runtime XAML `Button` and in particular an `AppBarButton`. If you're defining commands for Windows Runtime apps, you use basically the same techniques you'd use for defining commands for a .NET app. Implement the command by defining a class that implements <xref:System.Windows.Input.ICommand> and specifically implement the <xref:System.Windows.Input.ICommand.Execute%2A> method.
95+
96+
XAML for Windows Runtime does not support `x:Static`, so don't attempt to use the `x:Static` markup extension if the command is used from Windows Runtime XAML. Also, the Windows Runtime does not have any predefined command libraries, so the XAML syntax shown here doesn't really apply for the case where you're implementing the interface and defining the command for Windows Runtime usage.
97+
98+
## XAML attribute usage
99+
100+
```xaml
101+
<object-property="predefined-command-name"/>
100102
-or-
101-
102-
\<*object property*="*predefinedClassName.predefinedCommandName*"/>
103-
103+
<object-property="predefined-class-name.predefined-command-name"/>
104104
-or-
105-
106-
\<*object property*="{ *customClassName.customCommandName*}"/>
107-
108-
<a name="xamlValues_ICommand"></a>
109-
## XAML Values
110-
*predefinedClassName*
111-
One of the predefined command classes.
112-
113-
*predefinedCommandName*
114-
One of the predefined commands.
115-
116-
*customClassName*
117-
A custom class that contains the custom command. Custom classes generally require an `xlmns` prefix mapping; see [XAML Namespaces and Namespace Mapping for WPF XAML](/dotnet/framework/wpf/advanced/xaml-namespaces-and-namespace-mapping-for-wpf-xaml).
118-
119-
*customCommandName*
120-
A custom command.
121-
105+
<object-property="{custom-class-name.custom-command-name}"/>
106+
```
107+
108+
## XAML values
109+
110+
`predefined-class-name`\
111+
One of the predefined command classes.
112+
113+
`predefined-command-name`\
114+
One of the predefined commands.
115+
116+
`custom-class-name`\
117+
A custom class that contains the custom command. Custom classes generally require an `xlmns` prefix mapping. For more information, see [XAML Namespaces and Namespace Mapping for WPF XAML](/dotnet/framework/wpf/advanced/xaml-namespaces-and-namespace-mapping-for-wpf-xaml).
118+
119+
`custom-command-name`\
120+
A custom command.
121+
122122
]]></format>
123123
</remarks>
124124
</Docs>
@@ -169,16 +169,17 @@
169169
<Parameter Name="parameter" Type="System.Object" />
170170
</Parameters>
171171
<Docs>
172-
<param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to <see langword="null" />.</param>
173-
<summary>Defines the method that determines whether the command can execute in its current state.</summary>
172+
<param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to <see langword="null" />.</param>
173+
<summary>Determines whether the command can execute in its current state.</summary>
174174
<returns>
175175
<see langword="true" /> if this command can be executed; otherwise, <see langword="false" />.</returns>
176176
<remarks>
177-
<format type="text/markdown"><![CDATA[
178-
179-
## Remarks
180-
Typically, a command source calls the <xref:System.Windows.Input.ICommand.CanExecute%2A> method when the <xref:System.Windows.Input.ICommand.CanExecuteChanged> event is raised.
181-
177+
<format type="text/markdown"><![CDATA[
178+
179+
## Remarks
180+
181+
Typically, a command source calls the <xref:System.Windows.Input.ICommand.CanExecute%2A> method when the <xref:System.Windows.Input.ICommand.CanExecuteChanged> event is raised.
182+
182183
]]></format>
183184
</remarks>
184185
<altmember cref="T:System.Windows.Input.ICommandSource" />
@@ -229,15 +230,14 @@
229230
<ReturnType>System.EventHandler</ReturnType>
230231
</ReturnValue>
231232
<Docs>
232-
<summary>Occurs when changes occur that affect whether or not the command should execute.</summary>
233+
<summary>Occurs when changes take place that affect whether or not the command should execute.</summary>
233234
<remarks>
234-
<format type="text/markdown"><![CDATA[
235-
236-
## Remarks
237-
Normally, a command source calls <xref:System.Windows.Input.ICommand.CanExecute%2A> on the command when this event occurs.
238-
239-
Normally, if the command cannot execute, the command source disables itself.
240-
235+
<format type="text/markdown"><![CDATA[
236+
237+
## Remarks
238+
239+
Normally, a command source calls <xref:System.Windows.Input.ICommand.CanExecute%2A> on the command when this event occurs. If the command cannot execute, the command source disables itself.
240+
241241
]]></format>
242242
</remarks>
243243
<altmember cref="T:System.Windows.Input.ICommandSource" />
@@ -291,7 +291,7 @@
291291
<Parameter Name="parameter" Type="System.Object" />
292292
</Parameters>
293293
<Docs>
294-
<param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to <see langword="null" />.</param>
294+
<param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to <see langword="null" />.</param>
295295
<summary>Defines the method to be called when the command is invoked.</summary>
296296
<remarks>To be added.</remarks>
297297
<altmember cref="T:System.Windows.Input.ICommandSource" />

0 commit comments

Comments
 (0)