We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfTreeNavigator binding problem

Thread ID:





131022 Jun 16,2017 02:19 PM UTC Jun 19,2017 06:35 AM UTC WPF 1
Tags: SfTreeNavigator
Sasha Zuev
Asked On June 16, 2017 02:19 PM UTC

Hello guys. I have problem with SfTreeNavigator. Binding not working, not working even the example from the documentation. My code:
        <syncfusion:SfTreeNavigator Header=" Controllers" ItemsSource="{Binding Nodes}" Margin="10,10,560,10">
                <HierarchicalDataTemplate ItemsSource="{Binding Nodes}">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Name}" Foreground="Green" FontWeight="Bold" VerticalAlignment="Center" Margin="18 0 0 0"/>
Main form
        List<TreeNode> Controllers
                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; }
                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.

Vijayalakshmi Roopkumar [Syncfusion]
Replied On June 19, 2017 06:35 AM UTC

Hi Sasha

Thank you for contacting Syncfusion Support.

We have analyzed your problem and found that you have missed to set the DataContext in your application. DataContext is the main source of binding, so SfTreeNavigator control is not displayed in Window. We have prepared the sample for the same. Please refer the code example and sample from the following link: 
Code Example: [C#] 
public MainWindow() 
this.DataContext = new TreeViewModel(); 
Code Example: [XAML] 
Kindly check with above solution and let us know if it is helpful.

Vijayalakshmi V.R.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon