PSC.Blazor.Components.TreeView
1.0.4
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package PSC.Blazor.Components.TreeView --version 1.0.4
NuGet\Install-Package PSC.Blazor.Components.TreeView -Version 1.0.4
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="PSC.Blazor.Components.TreeView" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PSC.Blazor.Components.TreeView --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PSC.Blazor.Components.TreeView, 1.0.4"
#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.
// Install PSC.Blazor.Components.TreeView as a Cake Addin #addin nuget:?package=PSC.Blazor.Components.TreeView&version=1.0.4 // Install PSC.Blazor.Components.TreeView as a Cake Tool #tool nuget:?package=PSC.Blazor.Components.TreeView&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TreeView component for Blazor
This component is a native Blazor TreeView component for Blazor WebAssembly and Blazor Server. The components is build with .NET7.
Installation
First, add the package to your project from NuGet.
Then, add the following line to your _Imports.razor
:
@using PSC.Blazor.Components.TreeView
Usage
For adding the component to your page, use the following code:
<TreeView @key="version" Items="Items"
GetParent="GetParent" AllowSelection="true"
@bind-SelectedItems="SelectedValues">
<ItemTemplate>
<div @onclick="() => { selectedItem = (selectedItem != context.Item) ? context.Item : null; }"
style="background-color: @(selectedItem == context.Item ? "Highlight" : "inherit")">
@context.Item
</div>
</ItemTemplate>
</TreeView>
@if (SelectedValues != null && SelectedValues.Any())
{
<p>@string.Join(", ", SelectedValues)</p>
}
@code {
private string? selectedItem;
private List<string> SelectedValues = new List<string>
{
"3.1.1"
};
private List<string> Items = new List<string>
{
"1",
"1.1",
"1.2",
"2",
"3",
"3.1",
"3.1.1",
"3.1.2"
};
private string GetParent(string item)
{
var last_period = item.LastIndexOf('.');
if (last_period < 0)
{
return null; // no parent
}
else
{
return item.Substring(0, last_period);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- Microsoft.AspNetCore.Components.Web (>= 7.0.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.