#Form1.cs
private void TreeNavigator1_SelectionChanged(TreeNavigator sender, SelectionStateChangedEventArgs e)
{
TreenavigatorItemsUpdate(treeNavigator1, e);
}
private void TreenavigatorItemsUpdate(TreeNavigator sender, SelectionStateChangedEventArgs e)
{
TreeNavigator tree = sender as TreeNavigator;
dataBaseView.Table.Rows.Cast<DataRow>().ToList().ForEach(x =>
{
if (dataBaseView.Table.Columns.Contains(e.SelectedItem.Text))
e.SelectedItem.Items.Add(new TreeMenuItem() { Text = x[dataBaseView.Table.Columns[e.SelectedItem.Text]].ToString() });
});
} |
Private Sub FillItems(ByVal tree As TreeNavigator)
For Each col As DataColumn In dataBaseView.Table.Columns
Me.treeNavigator1.Items.Add(New TreeMenuItem() With {.Text = col.ColumnName})
Next col
For Each x As DataRow In dataBaseView.Table.Rows
For Each y As TreeMenuItem In Me.treeNavigator1.Items
If dataBaseView.Table.Columns.Contains(y.Text) Then
y.Items.Add(New TreeMenuItem() With {.Text = x(dataBaseView.Table.Columns(y.Text)).ToString()})
End If
Next y
Next x
End Sub |