Skip to content

Commit 6f95d35

Browse files
committed
934201: KB sample added
1 parent 6650ea6 commit 6f95d35

27 files changed

+1161
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@namespace LayoutWithJSON
2+
<Router AppAssembly="@typeof(App).Assembly">
3+
<Found Context="routeData">
4+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
5+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
6+
</Found>
7+
<NotFound>
8+
<PageTitle>Not found</PageTitle>
9+
<LayoutView Layout="@typeof(MainLayout)">
10+
<p role="alert">Sorry, there's nothing at this address.</p>
11+
</LayoutView>
12+
</NotFound>
13+
</Router>
14+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk.Web">
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<PackageReference Include="Syncfusion.Blazor.Diagram" Version="*" />
10+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="*" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<Folder Include="wwwroot\" />
14+
</ItemGroup>
15+
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk.Web">
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<PackageReference Include="Syncfusion.Blazor.Diagram" Version="*" />
10+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="*" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<Folder Include="wwwroot\" />
14+
</ItemGroup>
15+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LayoutWithJSON_NET8", "LayoutWithJSON_NET8.csproj", "{57C423F8-9634-43E6-B883-F4CE5CAC7D6A}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{57C423F8-9634-43E6-B883-F4CE5CAC7D6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{57C423F8-9634-43E6-B883-F4CE5CAC7D6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{57C423F8-9634-43E6-B883-F4CE5CAC7D6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{57C423F8-9634-43E6-B883-F4CE5CAC7D6A}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
@page "/"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
@using Syncfusion.Blazor.Data
5+
6+
<SfDiagramComponent @ref="Diagram" Width="1000px" Height="500px"
7+
NodeCreating="NodeDefaults" >
8+
<DataSourceSettings ID="Name" ParentID="Category">
9+
<SfDataManager Json="DataSource" Adaptor="Syncfusion.Blazor.Adaptors.JsonAdaptor"></SfDataManager>
10+
</DataSourceSettings>
11+
<Layout HorizontalSpacing="40" VerticalSpacing="40" Type="LayoutType.HierarchicalTree"></Layout>
12+
</SfDiagramComponent>
13+
14+
@code
15+
{
16+
SfDiagramComponent Diagram;
17+
// Create the hierarchical details with needed properties.
18+
public class HierarchicalDetails
19+
{
20+
public string Name { get; set; }
21+
public string FillColor { get; set; }
22+
public string Category { get; set; }
23+
}
24+
25+
// Create the data source with node name and fill color values.
26+
public HierarchicalDetails[] DataSource = new HierarchicalDetails[]
27+
{
28+
new HierarchicalDetails(){ Name ="Diagram", Category="",FillColor="#659be5"},
29+
new HierarchicalDetails(){ Name ="Layout", Category="Diagram",FillColor="#659be5"},
30+
new HierarchicalDetails(){ Name ="Organizational chart", Category="Diagram",FillColor="#659be5"},
31+
new HierarchicalDetails(){ Name ="Tree layout", Category="Layout",FillColor="#659be5"},
32+
new HierarchicalDetails(){ Name ="Hierarchical tree", Category="Tree layout",FillColor="#659be5"},
33+
};
34+
35+
// Defines the node's default values.
36+
private void NodeDefaults(IDiagramObject obj)
37+
{
38+
Node node = obj as Node;
39+
node.Height=50;
40+
node.Width = 150;
41+
HierarchicalDetails hierarchicalData = node.Data as HierarchicalDetails;
42+
node.Style.Fill = hierarchicalData.FillColor;
43+
node.Annotations = new DiagramObjectCollection<ShapeAnnotation>()
44+
{
45+
new ShapeAnnotation()
46+
{
47+
Content = hierarchicalData.Name
48+
}
49+
};
50+
}
51+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@page "/"
2+
@namespace LayoutWithJSON.Pages
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4+
@{
5+
Layout = "_Layout";
6+
}
7+
8+
<component type="typeof(App)" render-mode="ServerPrerendered" />
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@using Microsoft.AspNetCore.Components.Web
2+
@namespace LayoutWithJSON.Pages
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4+
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
<head>
8+
<meta charset="utf-8" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10+
<base href="~/" />
11+
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
12+
<link href="css/site.css" rel="stylesheet" />
13+
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
14+
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
15+
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
16+
</head>
17+
<body>
18+
@RenderBody()
19+
20+
21+
22+
<script src="_framework/blazor.server.js"></script>
23+
</body>
24+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
using Microsoft.AspNetCore.Components;
3+
using Microsoft.AspNetCore.Components.Web;
4+
using Syncfusion.Blazor;
5+
6+
var builder = WebApplication.CreateBuilder(args);
7+
8+
// Add services to the container.
9+
builder.Services.AddRazorPages();
10+
builder.Services.AddServerSideBlazor();
11+
builder.Services.AddSyncfusionBlazor();
12+
13+
var app = builder.Build();
14+
15+
// Configure the HTTP request pipeline.
16+
if (!app.Environment.IsDevelopment())
17+
{
18+
app.UseExceptionHandler("/Error");
19+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
20+
app.UseHsts();
21+
}
22+
23+
app.UseHttpsRedirection();
24+
25+
app.UseStaticFiles();
26+
27+
app.UseRouting();
28+
29+
app.MapBlazorHub();
30+
app.MapFallbackToPage("/_Host");
31+
32+
app.Run();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:11920",
7+
"sslPort": 44341
8+
}
9+
},
10+
"profiles": {
11+
"LayoutWithJSON": {
12+
"commandName": "Project",
13+
"dotnetRunMessages": true,
14+
"launchBrowser": true,
15+
"applicationUrl": "https://localhost:7204;http://localhost:5236",
16+
"environmentVariables": {
17+
"ASPNETCORE_ENVIRONMENT": "Development"
18+
}
19+
},
20+
"IIS Express": {
21+
"commandName": "IISExpress",
22+
"launchBrowser": true,
23+
"environmentVariables": {
24+
"ASPNETCORE_ENVIRONMENT": "Development"
25+
}
26+
}
27+
}
28+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@namespace LayoutWithJSON.Shared
2+
@inherits LayoutComponentBase
3+
4+
<PageTitle>LayoutWithJSON</PageTitle>
5+
6+
<div class="page">
7+
<div class="sidebar">
8+
</div>
9+
10+
11+
<main>
12+
13+
<article class="content px-4">
14+
@Body
15+
</article>
16+
</main>
17+
</div>

0 commit comments

Comments
 (0)