У меня есть следующий XAML:
<DataGrid Name="nodeDataGrid" ItemsSource="{Binding NodeList}" AutoGenerateColumns="False" RowBackground="White"
AlternatingRowBackground="AliceBlue" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Background="Silver" Margin="0,34,10,10" IsReadOnly="True" >
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" CanUserSort="True" SortDirection="Ascending" CellStyle="{StaticResource CellStyle}" />
<DataGridTextColumn Header="Category" Binding="{Binding Path=Category}" Width="*" />
<DataGridTemplateColumn Header="Children">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ListBox>
<TextBlock Text="{Binding}" />
</ListBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
и код позади:
private ServiceMapViewModel smViewModel = new ServiceMapViewModel();
public MainWindow()
{
InitializeComponent();
this.Loaded += (s, e) =>
{
this.DataContext = smViewModel;
};
}
В ServiceMapViewModel у меня есть NodeList вроде: List
И Node:
public string Name { get; set; }
public string Category { get; set; }
public string Group { get; set; }
public List<string> Children { get; set; }
public List<string> Parents { get; set; }
Мой вопрос: как связать список со свойством Chidren?