Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- default badges end -->
# Blazor Tabs - Create a Dynamic Tabbed Interface

The example demonstrates how to create an interactive multi-tab web interface with DevExpress Blazor [Tabs](https://docs.devexpress.com/Blazor/405074/components/layout/tabs) and [Context Menu](https://docs.devexpress.com/Blazor/405060/components/navigation-controls/context-menu) components.
The example creates an interactive multi-tab web interface with DevExpress Blazor [Tabs](https://docs.devexpress.com/Blazor/405074/components/layout/tabs) and [Context Menu](https://docs.devexpress.com/Blazor/405060/components/navigation-controls/context-menu) components.

![Multi-Tab UI](images/blazor-tabbed-ui.png)

Expand All @@ -17,7 +17,7 @@ It showcases core features that help end users build their personalized workspac

Place [DxTabs](https://docs.devexpress.com/Blazor/DevExpress.Blazor.DxTabs) container on the page ([Index.razor](CS/DxBlazorApplication1/Components/Pages/Index.razor)) and add a [DxTabPage](https://docs.devexpress.com/Blazor/DevExpress.Blazor.DxTabPage) for each tab.

Insert your custom Blazor components or content directly into each DxTabPage.
Insert your custom Blazor components or content directly into each `DxTabPage`.

```razor
<DxTabs @ref=tabs
Expand All @@ -37,15 +37,15 @@ Insert your custom Blazor components or content directly into each DxTabPage.
</DxTabPage>
```

The CssClass property of a tab page serves as a unique identifier, allowing client-side scripts to interact with specific tabs.
The `CssClass` property of a tab page serves as a unique identifier, allowing client-side scripts to interact with specific tabs.

### Persist Tab State

Implement a custom `MDITab` class to encapsulate specific properties of each individual tab. `MDITabCollection` will control visibility, display order, and titles of all tabs. The title links an underlying object to the visual tab representation in the UI.
Implement a custom `MDITab` class ([MDITab.cs](CS/DxBlazorApplication1/Components/MDI/MDITab.cs)) to encapsulate specific properties of each individual tab. `MDITabCollection` class ([MDITabCollection.cs](CS/DxBlazorApplication1/Components/MDI/MDITabCollection.cs)) will control visibility, display order, and titles of all tabs. The title links an underlying object to the visual tab representation in the UI.

Bind these properties to the visual tab elements in the UI. To ensure the `MDITabCollection` accurately reflects the live interface, implement event handlers for TabReorder and TabClosing. These handlers will listen for user actions and dynamically update the collection to match the current tab state.
Bind these properties to the visual tab elements in the UI. To ensure the `MDITabCollection` accurately reflects the live interface, implement event handlers for `TabReorder` and `TabClosing`. These handlers will listen for user actions and dynamically update the collection to match the current tab state.

To maintain the tab layout across sessions, serialize the collection to JSON and save it to the browser's local storage with `MDIStateHelper` class every time the UI layout changes. It maintains the tab visibility and order even after the user closes and reopens the browser. Tab state is restored in the OnAfterRenderAsync event handler.
To maintain the tab layout across sessions, serialize the collection to JSON and save it to the browser's local storage with `MDIStateHelper` class ([MDIStateHelper.cs](CS/DxBlazorApplication1/Components/MDI/MDIStateHelper.cs)) every time the UI layout changes. It maintains the tab visibility and order even after the user closes and reopens the browser. Tab state is restored in the `OnAfterRenderAsync` event handler.

### Add Context Menu to Tabs

Expand All @@ -69,7 +69,7 @@ Place [DxContextMenu](https://docs.devexpress.com/Blazor/DevExpress.Blazor.DxCon
</DxContextMenu>
```

Implement a client-side script ([mdi.js](CS/DxBlazorApplication1/wwwroot/js/mdi.js)) to handle right-clicks on specific tabs, identified by their CssClass property. This script should prevent the default browser context menu. Capture the mouse position, and invoke a .NET `[JSInvokable]` method.
Implement a client-side script ([mdi.js](CS/DxBlazorApplication1/wwwroot/js/mdi.js)) to handle right-clicks on specific tabs, identified by their `CssClass` property. This script should prevent the default browser context menu. Capture the mouse position, and invoke a .NET `[JSInvokable]` method.

## Files to Review

Expand Down
Loading