Я смотрю на сложную структуру и не могу найти способ ее отобразить ...
Моя ситуация:
Класс: Milestone имеет 2 списка внутри,список других подуровней и список действий.
Структура может быть такой:
M1
У кого-нибудь есть идеио том, как это создать?или может подтолкнуть меня в направлении?
ОТВЕТЬТЕ на мою проблему
<TreeView ItemsSource="{Binding Path=Project.TrackList}">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type deto:Track}" ItemsSource="{Binding Path=FaseList}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=TrackType}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type deto:Fase}" ItemsSource="{Binding Path=MilestoneList}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=FaseType}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type deto:Milestone}" ItemsSource="{Binding Converter={StaticResource MConverter}}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Description}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type deto:Activity}" ItemsSource="{Binding Path=ActivityList}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Description}" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.Resources>
</TreeView>
И конвертер:
public class MilestoneConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var m = value as Milestone;
CompositeCollection collection = new CompositeCollection();
collection.Add(new CollectionContainer()
{
Collection = m.MilestoneList
});
collection.Add(new CollectionContainer()
{
Collection = m.ActivityList
});
return collection;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}