troubleshooting Question

xaml hierarchical data

Avatar of razza_b
razza_b asked on
.NET ProgrammingMicrosoft Development
26 Comments1 Solution603 ViewsLast Modified:
Hi Experts

I have a treeview in SL4 that is being populated by a SP by using linq, but my hierarchical data in the xaml isnt displaying properly and just needed some help trying to get it to have the correct display. right now all data comes back but is displayed as..

  Category
> screename
> screename
> screename
  Category
> screename
> screename
> screename

but i need it as...
> Category
   screenname
   screenname
   screenname
> Category
   screenname
   screenname
   screenname

see screenshot of tree and DB data attached.

this is my xaml., i just need it tweaked to display the data explained above.
            <StackPanel x:Name="sp" Orientation="Vertical" >
                <StackPanel.Resources>
                   
                    <common:HierarchicalDataTemplate x:Key="CategoryTemplate">
                        <StackPanel>
                            <TextBlock FontStyle="Italic" Text="{Binding Category}" Margin="5,0"/>
                        </StackPanel>
                    </common:HierarchicalDataTemplate>
                   
                    <common:HierarchicalDataTemplate x:Key="ScreennameTemplate"  
                        ItemsSource="{Binding ScreenPath}"
                        ItemTemplate="{StaticResource CategoryTemplate}">
                        <TextBlock FontStyle="Italic" Text="{Binding Screenname}" Margin="5,0"/>
                    </common:HierarchicalDataTemplate>
                   
                </StackPanel.Resources>
               
                <controls:TreeView Width="190"  Height="598"  
                 ItemTemplate="{StaticResource ScreennameTemplate}" x:Name="treeView1" />
            </StackPanel>


Thanks


 SL-Treeview.docx SL-Treeview.docx
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 26 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 26 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros