Search Results

Search found 1 results on 1 pages for 'paull'.

Page 1/1 | 1 

  • WPF - DataTemplate to show only one hierarchical level in recursive data

    - by Paull
    Hi all, I am using a tree to display my data: persons grouped by their teams. In my model a team can contain another team, so the recursion. I want do display details about the selected node of the tree using a contentpresenter. If the selection is a person, everything is fine: I can show the person name or datails without problem using a simple datatemplate. If the selection is a team I would like to display the team name followed by a list of member names. If one of these members is another team I would like to display just the team name, without recursion... My code here is wrong because it displays data in a recursive way, what is the right way of doing it? Thanks in advance for any help! best regards, Paolo <ContentPresenter Content="{Binding Path=SelectedItem, ElementName=PeopleTree}" > <ContentPresenter.Resources> <DataTemplate DataType="{x:Type my:PersonViewModel}"> <TextBlock Text="{Binding PersonName}"/> </DataTemplate> <DataTemplate DataType="{x:Type my:TeamViewModel}"> <StackPanel> <TextBlock Text="{Binding TeamName}" /> <ListBox ItemsSource="{Binding Members}" /> </StackPanel> </DataTemplate> </ContentPresenter.Resources> </ContentPresenter>

    Read the article

1