none
WPF TreeView MultiBinding RRS feed

  • Вопрос

  • Good Day

    I've a trouble with TreeView Multibinding in WPF.

     

    I have some classes and TreeView Control

    Classes:

    public class Company{
        public string Title {get; set;}
        public string Country {get; set;}
       
        public List<Company> ChildCompanies {get; set;}
        public Company ParentCompany {get; set;}
        public List<Project> Projects {get; set;}
    }

    public class Project{
        public string Title {get; set;}
        public int Price {get; set;}
        public Company ParentCompany {get; set;}
    }

     

    And Something like this:

     

    <Window>
        ...
        ...
        <Window.Resources>
            <HierarhicalDataTemplate DataType="{x:Type local:Company}">
                <HierarhicalDataTemplate.ItemsSource>
                    <MultiBinding Converter="">  !!!!!!!!!!!!!!!!!!!!!!!!!
                        <Binding Path="ChildCompanies"/>
                        <Binding Path="Projects"/>
                    </MultiBinding>
                </HierarhicalDataTemplate.ItemsSource>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Title}"/>
                </StackPanel>
            </HierarhicalDataTemplate>
        </Window.Resources>
       
        <TreeView Name="CorporationTree"></TreeView>
    </Window>

     

    I need to see in treeview control the elements of two classes like in Windows explorer, where:

    Companies it's spmething like folders with subfolders possibility

    and Projects it's something like Files in current Folders.

    I don't understand how to implement this multibinding and i don't understand what is converter and how it works.

     

    Please help to solve this problem.

    23 октября 2010 г. 16:38

Ответы