Question

Basically what I need to know is how to send the source of an HierarchicalDataTemplate into a binding, this is what I have:

<HierarchicalDataTemplate DataType="{x:Type myModel:Person}">
    <StackPanel Orientation="Horizontal">
        <Image Source="Images\User.gif" />
        <TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
    </StackPanel>
    <HierarchicalDataTemplate.ItemsSource>
        <MultiBinding Converter="{StaticResource PersonConverter}">
            <Binding Path="Name" />
            <!-- Here I need something like Binding Path="Self" so I can send the source of the binding (the "Person" object) -->
        </MultiBinding>
    </HierarchicalDataTemplate.ItemsSource>
</HierarchicalDataTemplate>

So my source is an object of type myModel:Person, I want to be able to send the object itself in the MultiBinding so the PersonConverter can use it.

Thanks for any help.

Was it helpful?

Solution

Wow, I did a crazy wild guess and it worked =S lol, here's the solution

<MultiBinding Converter="{StaticResource PersonConverter}">
    <Binding Path="Name" />
    <Binding Path="." /> <!-- this sends the source of the binding -->
</MultiBinding>

Thanks!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top