Ask a questionAsk a question
 

General DiscussionWPF TreeView Multiple Sources

  • Friday, November 06, 2009 6:26 PMIgor Kondrasovas Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hello,

    I have seem some posts similar to what I'm trying to do (but now the same thing):

    I have treeview bound to a list of business objects of type PieceGroup, that represents a group of pieces that must be produced. The items on the treeview are groupd by the Material property (complex type). This is working fine.

    Now, I would like to have child nodes of every material type that are not members of the material property, so I will have to build the list of children programatically. I was thiniing about using a converter, but it seems not to be working. Here is what I'm doing today

    <pre lang=x-xml><CollectionViewSource x:Key="MaterialProcessingSource">
                <CollectionViewSource.GroupDescriptions>
                    <PropertyGroupDescription PropertyName="Material">
                    </PropertyGroupDescription>
                </CollectionViewSource.GroupDescriptions>
            </CollectionViewSource>
    
            <DataTemplate x:Key="repositoryTemplate">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Path=width"/>
                    <TextBlock Text=" X "/>
                    <TextBlock Text="{Binding Path=length}"/>
                </StackPanel>
            </DataTemplate>
    
            <HierarchicalDataTemplate x:Key="detailDataTemplate"
                ItemsSource="{Binding Path=Items}" ItemTemplate="{StaticResource repositoryTemplate}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Items[0].Material.code }"/>
                    <TextBlock Text=" - "/>
                    <TextBlock Text="{Binding Items[0].Material.description }"/>
                </StackPanel>
            </HierarchicalDataTemplate>
    


    I think that I must somehow change my detailDataTemplate binding to bind to a runtime generated list, based on my business requirements. How can I do that?

    Thanks in Advance,

    Igor
    Project Manager at INOVATIVA Tecnologia www.inovativatec.com

All Replies

  • Saturday, November 07, 2009 1:59 PMRammohan Ammiti Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     



    Hi,


    Here, my example chk it multiple source functionaly is there.. with dynamacally functionality..

    http://www.sendspace.com/file/g0pzws



    Thanks
    Ram
  • Tuesday, November 10, 2009 7:54 AMLinda LiuMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Igor,

    > Now, I would like to have child nodes of every material type that are not members of the material property, so I will have to build the list of children programatically.

    What do you mean in the above sentence?
    Coud you please create a simple project to demonstrate what you want and send it to me. My email address is v-lliu@microsoft.com.

    Sincerely,
    Linda Liu
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Thursday, November 12, 2009 4:00 AMLinda LiuMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Igor,

    How about the problem now? If you need help, please feel free to let me know.

    Sincerely,
    Linda Liu


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Monday, November 16, 2009 3:31 AMLinda LiuMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    We are changing the issue type to “General Discussion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.