TreeView Databinding

Posted by Anu on Stack Overflow See other posts from Stack Overflow or by Anu
Published on 2010-04-16T09:12:56Z Indexed on 2010/04/16 9:23 UTC
Read the original article Hit count: 419

Filed under:
|
|

Hi,I want to add items in treeviewi n WPF.I have function as

 public void SetTree(string Title,int Boxtype,int BoxNo )
        {
            sBoxType = "Group";
            TreeList items = TreeList.Load(Title, sBoxType, BoxNo);
            DataContext = items; 
        }

XAML Code of TreeView:

<TreeView Margin="16,275,18,312" x:Name="treeView1" ItemsSource="{Binding}" ItemTemplate="{StaticResource TreeItemTemplate}">
              </TreeView>

 <DataTemplate x:Key="TreeItemTemplate">
            <WrapPanel>
                <TextBlock Text="{Binding Path=Title}" /> 
                 <TextBlock Text="{Binding Path=Box}" />  
             </WrapPanel>
        </DataTemplate>

Actually i wan to TreeView ot display lik

+Group (header) 
      Controllersgroup   5 (Child items).

As multicolumn child items.But it dislay like

Controllersgroup5

© Stack Overflow or respective owner

Related posts about treeview

Related posts about wpf