In this article we will be seeing how to create Silverlight TreeView control.
In this article we will be seeing how to create Silverlight TreeView control. Xaml: <sdk:TreeView/> Steps Involved: Creating a Silverlight Application:
Creating the UI: Open MainPage.xaml file and replace the code with the following one. <UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="TreeViewControl.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="Gray"> <sdk:TreeView x:Name="Menu" Height="250" Width="250"> <sdk:TreeViewItem Header="Menu"> <sdk:TreeViewItem Header="SubMenu1"> <sdk:TreeViewItem Header="Item1"/> <sdk:TreeViewItem Header="Item2"/> <sdk:TreeViewItem Header="Item3"/> </sdk:TreeViewItem> <sdk:TreeViewItem Header="SubMenu2"> <sdk:TreeViewItem Header="Item1"/> <sdk:TreeViewItem Header="Item2"/> <sdk:TreeViewItem Header="Item3"/> </sdk:TreeViewItem> </sdk:TreeViewItem> </sdk:TreeView> </Grid> </UserControl> Hit F5. Output:
Printing in C# Made Easy
C# Corner MVP|Microsoft MVP|Application Modernization Architect|Modern Workplace Architect - SharePoint, .NET, Office 365, Azure, AWS Note: The opinions expressed here represent my own and not those of my employer.