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. Image for the cookie policy date

How to programmatically scroll GridTreeControl to node


Hi.

I have a reference to the node.
How to show the user this node, when you press the button ?

3 Replies

SP Sowndaiyan Paulpandi Syncfusion Team December 28, 2015 12:42 PM UTC

Hi Murad,

Thanks for contacting Syncfusion Support.

We have analyzed your query. In GridTreeControl you can programmatically scroll the GridTreeControl to particular node like the below code example,

Code Example [C#]

 
 
      public MainWindow()

        {

            InitializeComponent();

            this.treeGrid.Loaded += treeGrid_Loaded;

        }


        void treeGrid_Loaded(object sender, RoutedEventArgs e)

        {         
            //Scroll into the 30th row and 3rd column

            treeGrid.InternalGrid.ScrollInView(new RowColumnIndex(30, 3));

        }




We also we have the following methods in GridTreeControl to perform the scrolling operations,

Methods


GridTreeControl.InternalGrid.ScrollToBottom();



GridTreeControl.InternalGrid.ScrollToLeftEnd();



GridTreeControl.InternalGrid.ScrollToTop();




GridTreeControl.InternalGrid.ScrollToRightEnd();





Regards,

Sowndaiyan



MU Murad December 29, 2015 10:26 AM UTC

How to get RowColumnIndex from node ?

private static void GotoMessage(object[] args)
        {
            var gridTree = (GridTreeControl)args[0];
            var message = (Message)args[1];
            if (gridTree == null || message == null) return;

            var node = FirstNodeByName(message.DocumentElement.Name, gridTree.InternalGrid.Nodes);

            node.IsSelected = true;
            gridTree.InternalGrid.SelectedNodes.Add(node);

            var nodesExpand = new List<GridTreeNode>();
            // Expanded nodes
            while (true)
            {
                if (node == null) break;

                nodesExpand.Add(node);
                node = node.ParentNode;
            }

            for (var i = nodesExpand.Count - 1; i >= 0; i--)
                gridTree.ExpandNode(nodesExpand[i]);

            // Scroll to node
    // How to obtain the rowIndex and colIndex ?
            // gridTree.InternalGrid.ScrollInView(new RowColumnIndex(rowIndex, colIndex));
        }


SP Sowndaiyan Paulpandi Syncfusion Team December 30, 2015 02:02 PM UTC

Hi Murad,

In GridTreeControl, the Node denotes the each Row. So you can only get the corresponding RowIndex using the Node and  you have to use the column index manually. And perform the scrolling operation based upon that specific RowColumnIndex like the below code example.

Code Example [C#]

 
 
  var rowIndex = treeGrid.InternalGrid.GetRowIndexFromNode(Node);
   GridTreeControl.InternalGrid.ScrollInView(
new RowColumnIndex(rowIndex, columnIndex));




Regards,
Sowndaiyan

Loader.
Live Chat Icon For mobile
Up arrow icon