MeshWeaver.Layout
2.0.3
dotnet add package MeshWeaver.Layout --version 2.0.3
NuGet\Install-Package MeshWeaver.Layout -Version 2.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MeshWeaver.Layout" Version="2.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.Layout" Version="2.0.3" />
<PackageReference Include="MeshWeaver.Layout" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MeshWeaver.Layout --version 2.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MeshWeaver.Layout, 2.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=MeshWeaver.Layout&version=2.0.3
#tool nuget:?package=MeshWeaver.Layout&version=2.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MeshWeaver.Layout
Overview
MeshWeaver.Layout provides core abstractions for UI controls in the MeshWeaver ecosystem. It defines view models that can be implemented by different UI frameworks (like Blazor) and supports data binding, templating, and interactive updates.
Installation
Server Configuration
// Configure layout in message hub
configuration
.AddLayout(layout =>
layout
.WithView(
"StaticView",
Controls.Stack.WithView("Hello", "Hello").WithView("World", "World")
)
.WithView("ViewWithProgress", ViewWithProgress)
.WithView("UpdatingView", UpdatingView())
.WithView(
"ItemTemplate",
layout.Hub.GetWorkspace()
.GetStream(typeof(DataRecord))
.Select(x => x.Value.GetData<DataRecord>())
.DistinctUntilChanged()
.BindMany(record => Controls.Text(record.DisplayName))
)
);
Client Configuration
// Configure layout client
configuration.AddLayoutClient();
Usage Examples
Basic Controls
// Stack of HTML controls
Controls.Stack
.WithView("Hello", "Hello")
.WithView("World", "World")
Data Binding
// Binding to a data model
record Toolbar(int Year);
var toolbar = new Toolbar(2024);
return Controls.Stack
.WithView(
Template.Bind(
toolbar,
tb => Controls.Text(tb.Year),
"toolbar"
),
"Toolbar"
)
.WithView((area, _) =>
area.GetDataStream<Toolbar>("toolbar")
.Select(tb => Controls.Html($"Report for year {tb.Year}")),
"Content"
);
Interactive Controls
// Counter with click action
Controls.Stack
.WithView(
Controls.Html("Increase Counter")
.WithClickAction(context =>
context.Host.UpdateArea(
new("Counter/Counter"),
Controls.Html((++counter))
)
),
"Button"
)
.WithView(
Controls.Html(counter.ToString()),
"Counter"
);
Data Grid
// Data grid with columns
var data = new DataRecord[] { new("1", "1"), new("2", "2") };
return area.ToDataGrid(data, grid => grid
.WithColumn(x => x.SystemName)
.WithColumn(x => x.DisplayName)
);
Item Templates
// Template for repeating items
data.BindMany(record =>
Controls.Text(record.DisplayName)
.WithId(record.SystemName)
);
Progress Indicators
// Updating progress
var percentage = 0;
var progress = Controls.Progress("Processing", percentage);
for (var i = 0; i < 10; i++)
{
await Task.Delay(30);
area.UpdateProgress(
new("ViewWithProgress"),
progress = progress with { Progress = percentage += 10 }
);
}
Features
- Data binding with automatic updates
- Template-based rendering
- Interactive event handling
- Progress tracking
- Grid and collection support
- Composable control hierarchy
Integration
- Framework-agnostic control definitions
- Supports multiple UI implementations
- Works with MeshWeaver messaging system
- Enables real-time updates
See Also
- MeshWeaver.Layout.Blazor - Blazor implementation
- Main MeshWeaver Documentation - More about MeshWeaver architecture
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- MeshWeaver.Data (>= 2.0.3)
- MeshWeaver.Data.Contract (>= 2.0.3)
- Microsoft.DotNet.Interactive.Formatting (>= 1.0.0-beta.25160.1)
- System.Text.Encodings.Web (>= 9.0.3)
- System.Text.Json (>= 9.0.3)
NuGet packages (9)
Showing the top 5 NuGet packages that depend on MeshWeaver.Layout:
Package | Downloads |
---|---|
MeshWeaver.Blazor
Package Description |
|
MeshWeaver.Kernel
Package Description |
|
MeshWeaver.GridModel
Package Description |
|
MeshWeaver.Charting
Package Description |
|
MeshWeaver.Blazor.ChartJs
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.3 | 514 | 3/24/2025 |
2.0.2 | 485 | 3/24/2025 |
2.0.1 | 144 | 3/21/2025 |
2.0.0 | 185 | 3/20/2025 |
2.0.0-preview3 | 130 | 2/28/2025 |
2.0.0-Preview2 | 157 | 2/10/2025 |
2.0.0-preview1 | 144 | 1/6/2025 |
1.0.1 | 148 | 10/8/2024 |
1.0.0 | 138 | 10/8/2024 |