Задайте вопросЗадайте вопрос
 

Предложенный ответHow to populate a WPF TreeView node from a datasource?

  • 10 октября 2006 г. 21:21markovuksanovic Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     

    I'm having a question about populating a treeview control node.

      <TreeView>
        <TreeViewItem Header="Node1">
          <TreeViewItem Header="Subnode1"/>
           ...
          <TreeViewItem Header="Subnode10"/>

        </TreeViewItem>
        <TreeViewItem Header="Node2">
          <TreeViewItem Header="Subnode1"/>
           ...
          <TreeViewItem Header="Subnode10"/>

        </TreeViewItem>
      </TreeView>

    Now, my problem is that I have a observableCollection that holds infrmation for subnodes that go into "Node1", and another observableCollection that holds information about subnodes that go into "Node2". Until runtime, I don't know which elements will be in the node1 nor how many of them will be... Does anyone know how can I bind the information from ObservableCollections to the nodes/subnodes?

    Thanks in advance,
    Marko Vuksanovic.

Все ответы