Hello guys. I have problem with SfTreeNavigator. Binding not working, not working even the example from the documentation. My code:
Xaml
<syncfusion:SfTreeNavigator Header=" Controllers" ItemsSource="{Binding Nodes}" Margin="10,10,560,10">
<syncfusion:SfTreeNavigator.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Nodes}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" Foreground="Green" FontWeight="Bold" VerticalAlignment="Center" Margin="18 0 0 0"/>
</StackPanel>
</HierarchicalDataTemplate>
</syncfusion:SfTreeNavigator.ItemTemplate>
</syncfusion:SfTreeNavigator>
Main form
List<TreeNode> Controllers
{
get
{
List<TreeNode> nodes = new List<TreeNode>();
foreach (CPolicyData cpd in aipolicy.Controllers)
{
ObservableCollection<TreeNode> node = new ObservableCollection<TreeNode>();
foreach (CTriggerData ctd in cpd.Triggers)
{
node.Add(new TreeNode() { Name = $"[{ctd.ID}] {ctd.Name}" });
}
nodes.Add(new TreeNode() { Name = $"{cpd.ID}", Nodes = node });
}
return nodes;
}
set => Controllers = value;
}
Tree node class
public class TreeNode : NotificationObject
{
private string name { get; set; }
public string Name
{
get { return name; }
set
{
name = value;
}
}
private ObservableCollection<TreeNode> nodes { get; set; }
public ObservableCollection<TreeNode> Nodes
{
get { return nodes; }
set { nodes = value; }
}
public TreeNode()
{
Nodes = new ObservableCollection<TreeNode>();
}
}
After programm starting control is empty.