This is a migrated thread and some comments may be shown as answers.

HierarchicalDataTemplate with dynamic path

1 Answer 152 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
TheLostLeaf
Top achievements
Rank 2
TheLostLeaf asked on 02 Feb 2010, 09:42 PM

Hello.
I am trying to make the Element field below 'FullName' be a dynamic value that reads from
{
Binding Path=Name}.
Something like this
<TextBox Text="{Binding Path=Element[{Binding Path=Name}].Value}" Margin="2"></TextBox>
but it doesnt work.

 

<UserControl.Resources> 
        <HierarchicalDataTemplate   
                       ItemsSource="{Binding Path=Elements}"   
            x:Key="TVTemplate">  
            <telerik:RadTreeView> 
                <WrapPanel> 
                    <TextBlock Text="{Binding  Path=Name}" Margin="2"></TextBlock> 
                        <TextBox Text="{Binding  Path=Element[FullName].Value}" Margin="2"></TextBox> 
                    </WrapPanel></telerik:RadTreeView> 
        </HierarchicalDataTemplate> 
    </UserControl.Resources> 

 

1 Answer, 1 is accepted

Sort by
0
TheLostLeaf
Top achievements
Rank 2
answered on 02 Feb 2010, 10:01 PM
Opps, dumb moment.

 

 <telerik:RadTreeView> 
                <WrapPanel> 
                    <TextBlock Text="{Binding  Path=Name}" Margin="2"></TextBlock> 
                        <TextBox Text="{Binding  Path=Value}" Margin="2"></TextBox> 
                    </WrapPanel> 
</telerik:RadTreeView> 
Since it was an XDocument it had a predifined field called Value i was looking for.
Tags
TreeView
Asked by
TheLostLeaf
Top achievements
Rank 2
Answers by
TheLostLeaf
Top achievements
Rank 2
Share this question
or