This question is locked. New answers and comments are not allowed.
Hi ,
I'm using C#,VS2010 and the latest rad controls.
I have a radoutlook bar and inside I have a treeview. I'm retrieving from my webservice an xml file and populate the treeview with the hierarchy.
My code is working perfect and it populates correctly my data and the hierarchy if I have the below in my XAML.
<layoutToolkit:Accordion Grid.Row="2" x:Name="MyAccordion" Width="210" SelectionMode="ZeroOrOne" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
SelectionSequence="CollapseBeforeExpand" >
<layoutToolkit:AccordionItem x:Name="BrowsersItem" Header="Browsers" Background="LightGray" >
<control:TreeView x:Name="Browsers" Height="Auto" Width="200" Background="LightGray" DataContext="{Binding Path=Items}">
<control:TreeView.ItemTemplate>
<c:HierarchicalDataTemplate ItemsSource="{Binding Path=Items}" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Source="{Binding Path=Image}" />
<TextBox Text="{Binding Path=Selection_Name}" IsReadOnly="True" >
<ToolTipService.ToolTip>
<ToolTip Content="{Binding Path=Selection_Name}">
<ToolTip.Background>
<LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
<GradientStop Color="Yellow" Offset="0.8"/>
<GradientStop Color="White" Offset="0"/>
</LinearGradientBrush>
</ToolTip.Background>
</ToolTip>
</ToolTipService.ToolTip>
</TextBox>
</StackPanel>
</c:HierarchicalDataTemplate>
</control:TreeView.ItemTemplate>
</control:TreeView>
</layoutToolkit:AccordionItem>
<layoutToolkit:AccordionItem Header="My Folders" Background="LightGray">
</layoutToolkit:AccordionItem>
<layoutToolkit:AccordionItem Header="Company Filing" Background="LightGray">
</layoutToolkit:AccordionItem>
</layoutToolkit:Accordion>
The above is populating the data and that means that my code is working fine.
But when I try to use the Radtreeview I cannot populate the hierarchy.
In my XAML I have the below.
<telerik:RadOutlookBar HorizontalAlignment="Stretch" Name="radOutlookBar1" VerticalAlignment="Stretch" Grid.RowSpan="4" Margin="0,23,0,0" >
<telerik:RadOutlookBarItem Header="Browsers" FontWeight="Bold"
Icon="../Images/Mail-32.png"
SmallIcon="../Images/Mail-32.png"
Tag="Browsers" >
<telerik:RadTreeView x:Name="Browsers_TreeView" IsLineEnabled="True" ItemsSource="{Binding Path=Items}" IsExpandOnDblClickEnabled="True" >
<telerik:RadTreeView.ItemTemplate>
<c:HierarchicalDataTemplate ItemsSource="{Binding Path=Items}" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Source="{Binding Path=Image}" />
<TextBox Text="{Binding Path=Selection_Name}" IsReadOnly="True" Style="{StaticResource OnlySelectedTextBox}" >
<ToolTipService.ToolTip>
<ToolTip Content="{Binding Path=Selection_Name}">
<ToolTip.Background>
<LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
<GradientStop Color="Yellow" Offset="0.8"/>
<GradientStop Color="White" Offset="0"/>
</LinearGradientBrush>
</ToolTip.Background>
</ToolTip>
</ToolTipService.ToolTip>
</TextBox>
</StackPanel>
</c:HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>
</telerik:RadTreeView>
</telerik:RadOutlookBarItem>
<telerik:RadOutlookBarItem Header="My Folders" FontWeight="Bold"
Icon="../Images/Folder-32.png"
SmallIcon="../Images/Folder-32.png"
Tag="My Folders" >
<telerik:RadTreeView x:Name="MyFolders_TreeView" IsLineEnabled="True">
<telerik:RadTreeViewItem Header="myfolders">
</telerik:RadTreeViewItem>
</telerik:RadTreeView>
</telerik:RadOutlookBarItem>
<telerik:RadOutlookBarItem Header="Company Filing" FontWeight="Bold"
Icon="../Images/Folder32.png"
SmallIcon="../Images/Folder32.png"
Tag="Company Filing" >
<telerik:RadTreeView x:Name="CompanyFiling_TreeView" IsLineEnabled="True">
<telerik:RadTreeViewItem Header="CompanyFiling">
</telerik:RadTreeViewItem>
</telerik:RadTreeView>
</telerik:RadOutlookBarItem>
</telerik:RadOutlookBar>
The {Binding Path=Items} is having all the values that I want and all the hierarchy.
in my code behind
this.Browsers_TreeView.ItemsSource = MyNewListItems; (All the items).
Why I cannot populate the children of my hierarchy ?
Just to remind you that the same code is running for the accordion and the treeview inside the accordion.
Any ideas ?
thank you
I'm using C#,VS2010 and the latest rad controls.
I have a radoutlook bar and inside I have a treeview. I'm retrieving from my webservice an xml file and populate the treeview with the hierarchy.
My code is working perfect and it populates correctly my data and the hierarchy if I have the below in my XAML.
<layoutToolkit:Accordion Grid.Row="2" x:Name="MyAccordion" Width="210" SelectionMode="ZeroOrOne" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
SelectionSequence="CollapseBeforeExpand" >
<layoutToolkit:AccordionItem x:Name="BrowsersItem" Header="Browsers" Background="LightGray" >
<control:TreeView x:Name="Browsers" Height="Auto" Width="200" Background="LightGray" DataContext="{Binding Path=Items}">
<control:TreeView.ItemTemplate>
<c:HierarchicalDataTemplate ItemsSource="{Binding Path=Items}" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Source="{Binding Path=Image}" />
<TextBox Text="{Binding Path=Selection_Name}" IsReadOnly="True" >
<ToolTipService.ToolTip>
<ToolTip Content="{Binding Path=Selection_Name}">
<ToolTip.Background>
<LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
<GradientStop Color="Yellow" Offset="0.8"/>
<GradientStop Color="White" Offset="0"/>
</LinearGradientBrush>
</ToolTip.Background>
</ToolTip>
</ToolTipService.ToolTip>
</TextBox>
</StackPanel>
</c:HierarchicalDataTemplate>
</control:TreeView.ItemTemplate>
</control:TreeView>
</layoutToolkit:AccordionItem>
<layoutToolkit:AccordionItem Header="My Folders" Background="LightGray">
</layoutToolkit:AccordionItem>
<layoutToolkit:AccordionItem Header="Company Filing" Background="LightGray">
</layoutToolkit:AccordionItem>
</layoutToolkit:Accordion>
The above is populating the data and that means that my code is working fine.
But when I try to use the Radtreeview I cannot populate the hierarchy.
In my XAML I have the below.
<telerik:RadOutlookBar HorizontalAlignment="Stretch" Name="radOutlookBar1" VerticalAlignment="Stretch" Grid.RowSpan="4" Margin="0,23,0,0" >
<telerik:RadOutlookBarItem Header="Browsers" FontWeight="Bold"
Icon="../Images/Mail-32.png"
SmallIcon="../Images/Mail-32.png"
Tag="Browsers" >
<telerik:RadTreeView x:Name="Browsers_TreeView" IsLineEnabled="True" ItemsSource="{Binding Path=Items}" IsExpandOnDblClickEnabled="True" >
<telerik:RadTreeView.ItemTemplate>
<c:HierarchicalDataTemplate ItemsSource="{Binding Path=Items}" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Source="{Binding Path=Image}" />
<TextBox Text="{Binding Path=Selection_Name}" IsReadOnly="True" Style="{StaticResource OnlySelectedTextBox}" >
<ToolTipService.ToolTip>
<ToolTip Content="{Binding Path=Selection_Name}">
<ToolTip.Background>
<LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
<GradientStop Color="Yellow" Offset="0.8"/>
<GradientStop Color="White" Offset="0"/>
</LinearGradientBrush>
</ToolTip.Background>
</ToolTip>
</ToolTipService.ToolTip>
</TextBox>
</StackPanel>
</c:HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>
</telerik:RadTreeView>
</telerik:RadOutlookBarItem>
<telerik:RadOutlookBarItem Header="My Folders" FontWeight="Bold"
Icon="../Images/Folder-32.png"
SmallIcon="../Images/Folder-32.png"
Tag="My Folders" >
<telerik:RadTreeView x:Name="MyFolders_TreeView" IsLineEnabled="True">
<telerik:RadTreeViewItem Header="myfolders">
</telerik:RadTreeViewItem>
</telerik:RadTreeView>
</telerik:RadOutlookBarItem>
<telerik:RadOutlookBarItem Header="Company Filing" FontWeight="Bold"
Icon="../Images/Folder32.png"
SmallIcon="../Images/Folder32.png"
Tag="Company Filing" >
<telerik:RadTreeView x:Name="CompanyFiling_TreeView" IsLineEnabled="True">
<telerik:RadTreeViewItem Header="CompanyFiling">
</telerik:RadTreeViewItem>
</telerik:RadTreeView>
</telerik:RadOutlookBarItem>
</telerik:RadOutlookBar>
The {Binding Path=Items} is having all the values that I want and all the hierarchy.
in my code behind
this.Browsers_TreeView.ItemsSource = MyNewListItems; (All the items).
Why I cannot populate the children of my hierarchy ?
Just to remind you that the same code is running for the accordion and the treeview inside the accordion.
Any ideas ?
thank you