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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to programmatically scroll GridTreeControl to node

Thread ID:

Created:

Updated:

Platform:

Replies:

121539 Dec 28,2015 10:11 AM UTC Dec 30,2015 02:02 PM UTC WPF 3
loading
Tags: GridTreeControl
Murad
Asked On December 28, 2015 10:11 AM UTC


Hi.

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

Sowndaiyan Paulpandi [Syncfusion]
Replied On 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


Murad
Replied On 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));
        }

Sowndaiyan Paulpandi [Syncfusion]
Replied On 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

CONFIRMATION

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.

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

;