> For the complete documentation index, see [llms.txt](https://docs.radicalframework.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.radicalframework.com/release-2/presentation/delegate-command.md).

# Commands and DelegateCommand

WPF and Universal Applications have a really handy way to handle the concept of a command: the `ICommand` interface (<http://msdn.microsoft.com/library/system.windows.input.icommand.aspx>).

Radical has its own implementation that allows to easily hook command logic using delegates. The Radical `DelegateCommand` adds a set of features on top of the default .Net `ICommand`.

Creating a command in Radical is as easy as:

```csharp
ICommand command =  DelegateCommand.Create()
    .OnCanExecute( state =>
    {
        //command validation logic.
        return true;
     } )
     .OnExecute( state =>
     {
         //command execution logic.
     } );
```

The command entry point is the `DelegateCommand` class, in the above sample used in a fluent interface manner.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.radicalframework.com/release-2/presentation/delegate-command.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
