-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TreeView Images and DataBinding (#80)
* Added support for SiteMap Xml documents * Added TreeView DataBinding events * Updated Blazor WebAssembly to 3.2 Preview 1 * Added Image and ImageToolTip support to the TreeView * Implemented TreeViewImageSet
- Loading branch information
1 parent
aa5b835
commit 3090384
Showing
98 changed files
with
1,022 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
using Microsoft.AspNetCore.Blazor.Hosting; | ||
using Microsoft.AspNetCore.Components.Authorization; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System.Threading.Tasks; | ||
|
||
namespace AfterBlazorClientSide | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
public static async Task Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
|
||
var builder = WebAssemblyHostBuilder.CreateDefault(args); | ||
builder.RootComponents.Add<App>("app"); | ||
|
||
builder.Services.AddScoped<AuthenticationStateProvider, StaticAuthStateProvider>(); | ||
|
||
await builder.Build().RunAsync(); | ||
|
||
} | ||
|
||
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) => | ||
BlazorWebAssemblyHost.CreateDefaultBuilder() | ||
.UseBlazorStartup<Startup>(); | ||
} | ||
|
||
public static class Startup | ||
{ | ||
|
||
public static string ApplicationName => "Blazor WebAssembly"; | ||
|
||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
samples/AfterBlazorServerSide/Pages/ControlSamples/TreeView/ArrowsImages.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@page "/ControlSamples/TreeView/ArrowsImages" | ||
@using static BlazorWebFormsComponents.Enums.TreeNodeTypes | ||
@using static BlazorWebFormsComponents.Enums.TreeViewImageSet | ||
|
||
<h2>TreeView Component homepage</h2> | ||
|
||
<p>Here is a simple static tree view</p> | ||
|
||
<TreeView ID="SampleTreeView" runat="server" | ||
OnTreeNodeCheckChanged="CheckChanged" | ||
ImageSet="Arrows" | ||
ShowCheckBoxes="Root|Parent"> | ||
<Nodes> | ||
<TreeNode Value="Home" | ||
NavigateUrl="/" | ||
Text="Home" | ||
Target="Content" | ||
Expanded="true"> | ||
<TreeNode Value="Foo" Text="Foo"></TreeNode> | ||
<TreeNode Value="Bar" Text="Bar"> | ||
<TreeNode Value="Baz" Text="Baz"> | ||
<TreeNode Value="BlazorMisterMagoo" Text="BlazorMisterMagoo"> | ||
|
||
</TreeNode> | ||
</TreeNode> | ||
</TreeNode> | ||
</TreeNode> | ||
</Nodes> | ||
</TreeView> | ||
|
||
Checkboxes clicked: @clickCount | ||
|
||
@code { | ||
|
||
public int clickCount { get; set; } = 0; | ||
|
||
private void CheckChanged(TreeNodeEventArgs args) { | ||
|
||
clickCount++; | ||
base.StateHasChanged(); | ||
|
||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
samples/AfterBlazorServerSide/Pages/ControlSamples/TreeView/BulletImages.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@page "/ControlSamples/TreeView/BulletImages" | ||
@using static BlazorWebFormsComponents.Enums.TreeNodeTypes | ||
@using static BlazorWebFormsComponents.Enums.TreeViewImageSet | ||
|
||
<h2>TreeView Component homepage</h2> | ||
|
||
<p>Here is a simple static tree view</p> | ||
|
||
<TreeView ID="SampleTreeView" runat="server" | ||
OnTreeNodeCheckChanged="CheckChanged" | ||
ImageSet="BulletedList" | ||
ShowCheckBoxes="Root|Parent"> | ||
<Nodes> | ||
<TreeNode Value="Home" | ||
NavigateUrl="/" | ||
Text="Home" | ||
Target="Content" | ||
Expanded="true"> | ||
<TreeNode Value="Foo" Text="Foo"></TreeNode> | ||
<TreeNode Value="Bar" Text="Bar"> | ||
<TreeNode Value="Baz" Text="Baz"> | ||
<TreeNode Value="BlazorMisterMagoo" Text="BlazorMisterMagoo"> | ||
|
||
</TreeNode> | ||
</TreeNode> | ||
</TreeNode> | ||
</TreeNode> | ||
</Nodes> | ||
</TreeView> | ||
|
||
Checkboxes clicked: @clickCount | ||
|
||
@code { | ||
|
||
public int clickCount { get; set; } = 0; | ||
|
||
private void CheckChanged(TreeNodeEventArgs args) { | ||
|
||
clickCount++; | ||
base.StateHasChanged(); | ||
|
||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
samples/AfterBlazorServerSide/Pages/ControlSamples/TreeView/BulletsNoExpand.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@page "/ControlSamples/TreeView/BulletsNoExpand" | ||
@using static BlazorWebFormsComponents.Enums.TreeNodeTypes | ||
@using static BlazorWebFormsComponents.Enums.TreeViewImageSet | ||
|
||
<h2>TreeView Bullets with No Expansion</h2> | ||
|
||
<p>Here is a simple static tree view with bullets for nodes and no expand / collapse capabilities</p> | ||
|
||
<TreeView ID="SampleTreeView" runat="server" | ||
ShowExpandCollapse="false" | ||
ImageSet="BulletedList"> | ||
<Nodes> | ||
<TreeNode Value="Home" | ||
NavigateUrl="/" | ||
Text="Home" | ||
Target="Content" | ||
Expanded="true"> | ||
<TreeNode Value="Foo" Text="Foo"></TreeNode> | ||
<TreeNode Value="Bar" Text="Bar"> | ||
<TreeNode Value="Baz" Text="Baz"> | ||
<TreeNode Value="BlazorMisterMagoo" Text="BlazorMisterMagoo"> | ||
|
||
</TreeNode> | ||
</TreeNode> | ||
</TreeNode> | ||
</TreeNode> | ||
</Nodes> | ||
</TreeView> |
42 changes: 42 additions & 0 deletions
42
samples/AfterBlazorServerSide/Pages/ControlSamples/TreeView/Images.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
@page "/ControlSamples/TreeView/Images" | ||
@using static BlazorWebFormsComponents.Enums.TreeNodeTypes | ||
|
||
<h2>TreeView Component homepage</h2> | ||
|
||
<p>Here is a simple static tree view</p> | ||
|
||
<TreeView ID="SampleTreeView" runat="server" | ||
OnTreeNodeCheckChanged="CheckChanged" | ||
ShowCheckBoxes="Root|Parent"> | ||
<Nodes> | ||
<TreeNode Value="Home" | ||
NavigateUrl="/" | ||
Text="Home" | ||
Target="Content" | ||
Expanded="true"> | ||
<TreeNode Value="Foo" Text="Foo" ImageToolTip="C# is Super!" ImageUrl="/img/csharp_56.png"></TreeNode> | ||
<TreeNode Value="Bar" Text="Bar"> | ||
<TreeNode Value="Baz" Text="Baz"> | ||
<TreeNode Value="BlazorMisterMagoo" Text="BlazorMisterMagoo"> | ||
|
||
</TreeNode> | ||
</TreeNode> | ||
</TreeNode> | ||
</TreeNode> | ||
</Nodes> | ||
</TreeView> | ||
|
||
Checkboxes clicked: @clickCount | ||
|
||
@code { | ||
|
||
public int clickCount { get; set; } = 0; | ||
|
||
private void CheckChanged(TreeNodeEventArgs args) { | ||
|
||
clickCount++; | ||
base.StateHasChanged(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
samples/AfterBlazorServerSide/Pages/ControlSamples/TreeView/SiteMapDataSource.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@page "/ControlSamples/TreeView/SiteMapDataSource" | ||
@using static BlazorWebFormsComponents.Enums.TreeNodeTypes | ||
|
||
<h2>TreeView SiteMapDataSource Sample</h2> | ||
|
||
<p>This is a treeview component bound to a SiteMap xml document</p> | ||
|
||
<TreeView @ref="SiteTreeView" | ||
DataSource="SiteMapSource" | ||
AutoGenerateDataBindings="False" | ||
runat="server"> | ||
|
||
<DataBindings> | ||
|
||
<TreeNodeBinding TextField="title" NavigateUrlField="url"/> | ||
|
||
</DataBindings> | ||
|
||
</TreeView> | ||
|
||
@code { | ||
|
||
public TreeView SiteTreeView; | ||
|
||
System.Xml.XmlDocument SiteMapSource = new System.Xml.XmlDocument(); | ||
|
||
protected override Task OnInitializedAsync() { | ||
|
||
Setup(); | ||
|
||
return base.OnInitializedAsync(); | ||
|
||
} | ||
|
||
void Setup() | ||
{ | ||
|
||
SiteMapSource.LoadXml(@"<siteMap> | ||
<siteMapNode title=""Home"" description=""Home"" url=""default.aspx""> | ||
<siteMapNode title=""Products"" description=""Products"" url=""Products.aspx""> | ||
<siteMapNode title=""Computers"" url=""Computers.aspx""/> | ||
<siteMapNode title=""Accessories"" url=""Accessories.aspx""/> | ||
</siteMapNode> | ||
</siteMapNode> | ||
</siteMap>"); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.