Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Reg: XamWebTree
posted

Hi,

I am having one xml file i need to bind that xml file to xamwebtree dynamically.  For that the below mentioned is xaml page:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<

 

 

 

UserControl xmlns:igTree="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.XamWebTree.v10.1"

 

 

 

x:Class

="Infragistics_XamWebTree.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"

 

 

 

xmlns:ig="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.v10.1"

 

 

 

 

mc:Ignorable

="d"

 

 

 

d:DesignHeight="300" d:DesignWidth

="400">

 

 

 

 

 

<Grid x:Name="LayoutRoot" Background

="White">

 

 

 

 

<igTree:XamWebTree x:Name="igWebTree" CheckBoxVisibility="Visible" CheckBoxMode="Auto" HorizontalAlignment

="Stretch"

 

 

 

ScrollViewer.VerticalScrollBarVisibility="Auto"

 

 

 

d:LayoutOverrides="Height" ItemsSource="{Binding}" >

 

 

 

 

 

>

 

 

 

 

</Grid

>

</

 

 

 

UserControl

>

And the below mentioned is the xaml.cs page

XDocument

 

 

categoriesXML = XDocument.Load("Products.xml");

categories = LoadDimensions(categoriesXML.Element(

 

"Root"));

igWebTree.ItemsSource = categories;

 

 

 

 

 

 

 

 

 

Private List<Products> LoadDimensions(XElement

element)

{

 

 

 

return (from Products in

element.Elements().Elements()

 

 

 

select new

Products()

{

Name = Products.Attribute(

 

 

"name"

).Value,

SubCategories =

 

 

this

.LoadDimensions(Products)

}).ToList();

}

And the below mentioned is the Products.xml file

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<?

 

 

xml version="1.0" encoding="utf-8" ?>

<Root>

<

 

 

dimension name="Products">

<

 

 

member name="Soap" FullPath="Products.Soap" isleaf="false">

<

 

 

member name="Dove" FullPath="Products.Soap.Dove" isleaf="true"/>

<

 

 

member name="Lux" FullPath="Products.Soap.Lux" isleaf="true"></member>

<

 

 

member name="Pears" FullPath="Products.Soap.Pears" isleaf="true"></member>

</

 

 

member>

<

 

 

member name="Cleaning" FullPath="Products.Cleaning" isleaf="true">

</

 

 

member>

<

 

 

member name="Food" FullPath="Products.Food" isleaf="true"></member>

</

 

 

dimension>

</

 

 

Root>

I am getting the output like this:

Infragistics_Xamwebtree.Products

Infragistics_Xamwebtree.Products

Infragistics_Xamwebtree.Products

with checkboxes before each node like this.  Let me know what i need to do.  Thanks in Advance.

Regards,

Amarendra.