# Windows Forms in Blazor

To illustrate how we use Blazor to modernize Windows Forms applications, we will use this simple example:

<figure><img src="/files/nXPOT2dq5PoxIfR6xJVt" alt="" width="459"><figcaption><p>Simple application to modernize</p></figcaption></figure>

In this scenario, when the button is clicked, the model (Counter) is updated, and the UI automatically reflects the changes.

Upon the successful completion of our Modernization process, the expected outcome will be as follows (the code has been significantly simplified for clarity):

<figure><img src="/files/IE3KTGKIBa1ljXI45Ywx" alt=""><figcaption><p>Modernized application structure</p></figcaption></figure>

* The original Windows Forms code remains essentially unchanged, with only minor modifications to accommodate the distinct characteristics of a desktop application to a server-side application.
* Razor components, along with their associated bindings and observers, are automatically generated as part of the modernization process. There's no need for you to create or modify this code manually.
* Bindings and observers trigger Razor components to generate HTML dynamically as needed. This HTML is then transmitted to the client, where the DOM is updated in real-time via Streaming Rendering, aiming to provide an experience as close as possible to that of a desktop application.

**The following diagram details the execution flow triggered when the button is pressed:**

<figure><img src="/files/du8I0wf1TnLGyGBUk9ou" alt=""><figcaption><p>Sample execution flow</p></figcaption></figure>


---

# Agent Instructions: 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.gapvelocity.ai/webmap-for-blazor-documentation/blazor-ai-migrator/modernization/windows-forms-in-blazor.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.
