![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Having problem with three levels in a tree control I've seen many posts on this problem but haven't found a solution yet. Any help would be greatly regarded. My data source is an xml file that looks like this. <?xml version="1.0" encoding="UTF-8"?> <DataLibrary version="0.1" > <Family><FamilyID>1</FamilyID><Name>ACTIVITY</ Name><SubFamily><SubFamilyID>1</SubFamilyID><Name>ACTION</ Name><LibraryItem><DataItemID>1</DataItemID><Name>ACTION</ Name><Example></Example><Qualifier>STATIC</Qualifier><DataType>TEXT</ DataType><DataEntryType>RESTRICTED </DataEntryType><Client>X</ Client><Company>X</Company><Iqor>X</Iqor><Employee></ Employee><Vendor></Vendor><Publisher>Call</Publisher><Subscriber></ Subscriber></LibraryItem> <LibraryItem><DataItemID>2</DataItemID><Name>SUB-ACTION</ Name><Example></Example><Qualifier>STATIC</Qualifier><DataType>TEXT</ DataType><DataEntryType>RESTRICTED </DataEntryType><Client>X</ Client><Company>X</Company><Iqor>X</Iqor><Employee></ Employee><Vendor></Vendor><Publisher>Attended</Publisher><Subscriber></ Subscriber></LibraryItem> </SubFamily> </Family> My XAML looks like this: <Window.Resources> <HierarchicalDataTemplate x:Key="ht1" DataType="Family" ItemsSource="{Binding XPath=DataLibrary/Family/Name}"> <TextBlock FontWeight="Bold" FontSize="20" Text="{Binding XPath=Name}" /> </HierarchicalDataTemplate> <HierarchicalDataTemplate x:Key="ht2" DataType = "SubFamily" ItemsSource="{Binding XPath=DataLibrary/Family/SubFamily/Name}"> <TextBlock FontWeight="Bold" FontSize="20" Text="{Binding XPath=Name}" /> </HierarchicalDataTemplate> <DataTemplate DataType="LibraryItem" > <TextBlock FontStyle="Italic" Text="{Binding XPath=Name}" / Quote: > <XmlDataProvider x:Key="LI" Source="DataLibrary.xml" /> </Window.Resources> <StackPanel> <TreeView> <TreeViewItem ItemsSource="{Binding Source={StaticResource LI}, XPath=DataLibrary}" Header="Data Library" /> </TreeView> </StackPanel> |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Having problem with three levels in a tree control Hello Bryan, you may try to change the following lines: <HierarchicalDataTemplate DataType="Family" ItemsSource="{Binding XPath=./SubFamily}" > <TextBlock FontWeight="Bold" FontSize="20" Text="{Binding XPath=Name}" /> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType = "SubFamily" ItemsSource="{Binding XPath=./LibraryItem}"> <TextBlock FontWeight="Bold" FontSize="20" Text="{Binding XPath=Name}" /> </HierarchicalDataTemplate> <TreeViewItem ItemsSource="{Binding Source={StaticResource LI}, XPath=DataLibrary/Family}" Header="Data Library" /> WilliB "dba" <bryanmurtha@xxxxxx> schrieb im Newsbeitrag news:4ab41b22-1d03-44a7-a860-3377908f6f01@xxxxxx Quote: > I've seen many posts on this problem but haven't found a solution yet. > Any help would be greatly regarded. My data source is an xml file that > looks like this. > > <?xml version="1.0" encoding="UTF-8"?> > <DataLibrary version="0.1" > > <Family><FamilyID>1</FamilyID><Name>ACTIVITY</ > Name><SubFamily><SubFamilyID>1</SubFamilyID><Name>ACTION</ > Name><LibraryItem><DataItemID>1</DataItemID><Name>ACTION</ > Name><Example></Example><Qualifier>STATIC</Qualifier><DataType>TEXT</ > DataType><DataEntryType>RESTRICTED </DataEntryType><Client>X</ > Client><Company>X</Company><Iqor>X</Iqor><Employee></ > Employee><Vendor></Vendor><Publisher>Call</Publisher><Subscriber></ > Subscriber></LibraryItem> > <LibraryItem><DataItemID>2</DataItemID><Name>SUB-ACTION</ > Name><Example></Example><Qualifier>STATIC</Qualifier><DataType>TEXT</ > DataType><DataEntryType>RESTRICTED </DataEntryType><Client>X</ > Client><Company>X</Company><Iqor>X</Iqor><Employee></ > Employee><Vendor></Vendor><Publisher>Attended</Publisher><Subscriber></ > Subscriber></LibraryItem> > </SubFamily> > </Family> > > My XAML looks like this: > > > <Window.Resources> > <HierarchicalDataTemplate x:Key="ht1" DataType="Family" > ItemsSource="{Binding XPath=DataLibrary/Family/Name}"> > <TextBlock FontWeight="Bold" FontSize="20" Text="{Binding > XPath=Name}" /> > </HierarchicalDataTemplate> > <HierarchicalDataTemplate x:Key="ht2" DataType = "SubFamily" > ItemsSource="{Binding XPath=DataLibrary/Family/SubFamily/Name}"> > <TextBlock FontWeight="Bold" FontSize="20" Text="{Binding > XPath=Name}" /> > </HierarchicalDataTemplate> > <DataTemplate DataType="LibraryItem" > > <TextBlock FontStyle="Italic" Text="{Binding XPath=Name}" / Quote: >> > <XmlDataProvider x:Key="LI" Source="DataLibrary.xml" /> > </Window.Resources> > <StackPanel> > <TreeView> > <TreeViewItem ItemsSource="{Binding Source={StaticResource > LI}, XPath=DataLibrary}" Header="Data Library" /> > </TreeView> > </StackPanel> > |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| HP g95 ink levels... | Vista print fax & scan | |||
| Audio levels | Media Center | |||
| Ink cartridge levels | Vista print fax & scan | |||
| Audio Levels | Vista General | |||
| Depth Levels of File Subdirectory Tree Allowed. | Vista hardware & devices | |||