# PageExtensions

Namespace: **Wisej.Web.Markup**

Assembly: **Wisej.Framework** (4.0.0.0)

Adds [fluent markup](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/markup/markup) extension methods to the [Page](/api/wisej.web/containers/wisej.web.page.md) class.

{% tabs %}
{% tab title="C#" %}

```csharp
public class PageExtensions
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class PageExtensions
```

{% endtab %}
{% endtabs %}

## Methods

### ![](/files/lIX317sDtMTZJBi9oSIx) AcceptButton\<TPage>(page, acceptButton)

Sets the accept button for the specified [Page](/api/wisej.web/containers/wisej.web.page.md) control.

| Parameter        | Type                                                                         | Description                                                                                        |
| ---------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **TPage**        |                                                                              | The type of the page, which must inherit from [Page](/api/wisej.web/containers/wisej.web.page.md). |
| **page**         | [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md) | The page for which to set the accept button.                                                       |
| **acceptButton** | [Button](/api/wisej.web/buttons/button.md)                                   | The button to be set as the accept button for the page.                                            |

**Returns:** [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md). The page with the updated accept button.

This method allows you to specify a button that will be triggered when the user presses the Enter key.

```csharp

mypage.AcceptButton(myAcceptButton);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Active\<TPage>(page, value)

Sets the Active property of the specified [Page](/api/wisej.web/containers/wisej.web.page.md).

| Parameter | Type                                                                         | Description                                                                                  |
| --------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **TPage** |                                                                              | The type of the page, must inherit from [Page](/api/wisej.web/containers/wisej.web.page.md). |
| **page**  | [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md) | The page for which to set the Active property.                                               |
| **value** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)              | A boolean indicating whether the page is active.                                             |

**Returns:** [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md). The modified page with the updated Active property.

This method allows you to mark a page as active or inactive using a fluent interface.

```csharp

myPage.Active(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) CancelButton\<TPage>(page, cancelButton)

Sets the cancel button for the specified [Page](/api/wisej.web/containers/wisej.web.page.md) control.

| Parameter        | Type                                                                         | Description                                                                                        |
| ---------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **TPage**        |                                                                              | The type of the page, which must inherit from [Page](/api/wisej.web/containers/wisej.web.page.md). |
| **page**         | [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md) | The page for which to set the cancel button.                                                       |
| **cancelButton** | [Button](/api/wisej.web/buttons/button.md)                                   | The button to be set as the cancel button for the page.                                            |

**Returns:** [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md). The page with the updated cancel button.

This method allows you to specify a button that will be triggered when the user presses the Escape key.

```csharp

mypage.CancelButton(myCancelButton);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnActivated\<TPage>(page, action)

Attaches an action to the Activated event of a page.

| Parameter  | Type                                                                         | Description                                                                                        |
| ---------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **TPage**  |                                                                              | The type of the page, which must inherit from [Page](/api/wisej.web/containers/wisej.web.page.md). |
| **page**   | [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md) | The page instance to attach the event to.                                                          |
| **action** | [Action\<TPage>](https://docs.microsoft.com/dotnet/api/system.action-1)      | The action to execute when the page is activated.                                                  |

**Returns:** [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md). The page instance with the attached Activated event action.

This method allows you to execute a specific action when the page's Activated event is triggered.

```csharp

var myPage = new MyPage();
myPage.OnActivated(page => AlertBox.Show("Page Activated"));

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnDeactivate\<TPage>(page, action)

Attaches an action to the Deactivate event of a page.

| Parameter  | Type                                                                         | Description                                                                                        |
| ---------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **TPage**  |                                                                              | The type of the page, which must inherit from [Page](/api/wisej.web/containers/wisej.web.page.md). |
| **page**   | [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md) | The page instance to attach the event to.                                                          |
| **action** | [Action\<TPage>](https://docs.microsoft.com/dotnet/api/system.action-1)      | The action to execute when the page is deactivated.                                                |

**Returns:** [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md). The page instance with the attached Deactivate event action.

This method allows you to execute a specific action when the page's Deactivate event is triggered.

```csharp

var myPage = new MyPage();
myPage.OnDeactivate(page => AlertBox.Show("Page Deactivated"));

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnLoad\<TPage>(page, action)

Attaches an action to the Load event of a page.

| Parameter  | Type                                                                         | Description                                                                                        |
| ---------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **TPage**  |                                                                              | The type of the page, which must inherit from [Page](/api/wisej.web/containers/wisej.web.page.md). |
| **page**   | [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md) | The page instance to attach the event to.                                                          |
| **action** | [Action\<TPage>](https://docs.microsoft.com/dotnet/api/system.action-1)      | The action to execute when the page is loaded.                                                     |

**Returns:** [TPage](/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.md). The page instance with the attached Load event action.

This method allows you to execute a specific action when the page's Load event is triggered.

```csharp

var myPage = new MyPage();
myPage.OnLoad(page => AlertBox.Show("Page Loaded"));

```


---

# 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.wisej.com/api/wisej.web.markup/extensions/wisej.web.markup.pageextensions.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.
