Do all items need share same base?

Jun 25, 2009 at 5:31 PM
Edited Jun 25, 2009 at 6:16 PM

I cannot get this framework to work.

EDIT: none of the methods (other than the constructor) are called in the class ComplexGroupDataTemplateSelector !?

With the tree nodes that should display the Group names and have items, I only get the BindingGroup.ToString() shown as the node names... "{BindingGroup of <my data type>}"

Is there a need for the involved classes to share the same namespace or base types?

The two arrays are simple arrays, not List<T>, though I did try that. I have also tried giving them both the same ancestor interface to no avail...

        <HierarchicalDataTemplate
            DataType="{x:Type inf:SqlServer}">
            <HierarchicalDataTemplate.ItemsSource>
                <MultiBinding
                    Converter="{StaticResource complex-group-converter}"
                    ConverterParameter="IEnumerable[Job],IEnumerable[Machines]">
                    <Binding Path="Jobs"/>
                    <Binding Path="Machines"/>
                </MultiBinding>
            </HierarchicalDataTemplate.ItemsSource>
            <TextBlock
                Text="{Binding Path=Name}"/>
        </HierarchicalDataTemplate>
       
        <HierarchicalDataTemplate
            x:Key="IEnumerable[Job]"
            ItemsSource="{Binding Path=.}">
            <TextBlock
                VerticalAlignment="Center" 
                Margin="5,0,0,0">Jobs</TextBlock>           
        </HierarchicalDataTemplate>

        <HierarchicalDataTemplate
            x:Key="IEnumerable[Machines]"
            ItemsSource="{Binding Path=.}">
            <TextBlock
                VerticalAlignment="Center" 
                Margin="5,0,0,0">Machines</TextBlock>
        </HierarchicalDataTemplate>

Jun 25, 2009 at 9:29 PM

I'm unsure if it is a namespace issue or what, but I've got the framework working with the additional specification of the ItemTemplateSelector upon each HierarchicalDataTemplate, e.g.
            ItemTemplateSelector="{StaticResource complex-group-data-template-selector}"

        <HierarchicalDataTemplate
            DataType="{x:Type ws:Job}"
            ItemsSource="{Binding Path=Sequences}"
            ItemTemplateSelector="{StaticResource complex-group-data-template-selector}">
            <TextBlock
                Text="{Binding Path=Caption}"/>
        </HierarchicalDataTemplate>