Articles in this section
Category / Section

How to populate a TreeViewAdv by using XML data with Bulletin support

1 min read

This article describes how to populate a TreeViewAdv control by using Extensible Markup Language data. As both XML and TreeViewAdv control represents the data in a hierarchical format, xml source is binded to TreeViewAdv using XmlDataProvider. Follow the below steps to populate TreeViewAdv control using xml file

Step1: Create the XML file.


  <Product Name="Tools" >
      <Feature Name="Ribbon" >
           <Feature Name="Office2010UI"/>
           <Feature Name="Data Binding Support"/>
      <Feature Name="Docking Manager">
            <Feature Name="Maximization"/>
            <Feature Name="State Persistence"/>
      <Feature Name="TreeView"> 
            <Feature Name="Editing"/>
            <Feature Name="Sorting"/>


Step2: Add the XmlDataProvider for the above XML file as follows


<XmlDataProvider Source="Data.xml" x:Key="xmlSource" XPath="Products"/>


Step3: Set the ItemSource property for the TreeViewAdv as follows


  <syncfusion:TreeViewAdv  ShowRootLines="False"                ItemsSource="{Binding Source={StaticResource xmlSource}, XPath=Product}" >
                <HierarchicalDataTemplate ItemsSource="{Binding XPath=Feature}">
                    <StackPanel Orientation="Horizontal">
                        <Image  Height="15" Source="Bullet.png"  Visibility="Visible"/>
                        <TextBlock Margin="10" Text="{Binding XPath=@Name}" />


The above code generate the following output

D:\My KB\Vol13.4\Sprint4\Images\sshot-5.png

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment