==============
Counter.razor:
==============
@page "/counter"
<h1>Counter</h1>
<p>Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
<button class="btn btn-danger" @onclick="OpenMiniWin">Open a kendo window</button>
<TelerikButton>Say Hello</TelerikButton>
<div>
<ul>
<li>All work and no play makes Jack a dull boy</li>
<li>All work and no play makes Jack a dull boy</li>
<li>All work and no play makes Jack a dull boy</li>
</ul>
</div>
<Tree IsSpecialIcons="true"></Tree>
<TelerikWindow Modal="true" Visible="@isVisibleMiniWin">
<WindowTitle>
<strong>The Title</strong>
</WindowTitle>
<WindowContent>
I am modal so the page behind me is not available to the user.
</WindowContent>
<WindowActions>
<WindowAction Name="Minimize" />
<WindowAction Name="Maximize" />
<WindowAction Name="Close" />
</WindowActions>
</TelerikWindow>
@code {
int currentCount = 0;
bool isVisibleMiniWin = false;
void IncrementCount()
{
currentCount++;
}
void OpenMiniWin()
{
isVisibleMiniWin = true;
}
}
==============
Tree.razor:
==============
<TelerikTreeView Data="@FlatData" >
<TreeViewBindings>
<TreeViewBinding IdField="Id" ParentIdField="ParentIdValue" ExpandedField="Expanded" TextField="Text" HasChildrenField="HasChildren" IconField="Icon" />
</TreeViewBindings>
</TelerikTreeView>
@code {
public class TreeItem
{
public int Id { get; set; }
public string Text { get; set; }
public int? ParentIdValue { get; set; }
public bool HasChildren { get; set; }
public string Icon { get; set; }
public bool Expanded { get; set; }
}
[Parameter]
public bool IsSpecialIcons { get; set; } = false;
public IEnumerable<TreeItem> FlatData { get; set; }
protected override void OnInitialized()
{
LoadFlatData();
}
private void LoadFlatData()
{
List<TreeItem> items = new List<TreeItem>();
items.Add(new TreeItem()
{
Id = 1,
Text = "Project",
ParentIdValue = null,
HasChildren = true,
Icon = "folder",
Expanded = true
});
items.Add(new TreeItem()
{
Id = 2,
Text = "Design",
ParentIdValue = 1,
HasChildren = true,
Icon = "brush",
Expanded = true
});
items.Add(new TreeItem()
{
Id = 3,
Text = "Implementation",
ParentIdValue = 1,
HasChildren = true,
Icon = "folder",
Expanded = true
});
items.Add(new TreeItem()
{
Id = 4,
Text = "site.psd",
ParentIdValue = 2,
HasChildren = false,
Icon = "psd",
Expanded = true
});
items.Add(new TreeItem()
{
Id = 5,
Text = "index.js",
ParentIdValue = 3,
HasChildren = false,
Icon = "js"
});
items.Add(new TreeItem()
{
Id = 6,
Text = "index.html",
ParentIdValue = 3,
HasChildren = false,
Icon = "html"
});
items.Add(new TreeItem()
{
Id = 7,
Text = "styles.css",
ParentIdValue = 3,
HasChildren = false,
Icon = "css"
});
FlatData = items;
}
}