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.

Bring a specific row into view

Thread ID:

Created:

Updated:

Platform:

Replies:

119303 Jun 3,2015 11:02 AM Jun 10,2015 09:03 AM WPF 4
loading
Tags: GanttControl
Nick Verschueren
Asked On June 3, 2015 11:02 AM

In our project a Gantt can have hunderds to even a few thousand resources shown as rows.
Is there a way to scroll to a specific row from code, either by index or by the bound item?


Nick Verschueren
Replied On June 4, 2015 05:33 AM

Meanwhile I found the following workaround for this, but I would appreciate a better solution if anybody has one.

public static class GanttControlExtensions
{
  public static void ScrollToItem(this GanttControl gantt, object item)
  {
    gantt.SelectedItems.Clear();
    gantt.SelectedItems.Add(item);
    var idx = gantt.Model.GetRowIndexFromItem(item);
    var border = VisualTreeHelper.GetChild(gantt.GanttGrid, 0);
    var scrollViewer = (ScrollViewer)VisualTreeHelper.GetChild(border, 0);
    scrollViewer.ScrollToVerticalOffset(Math.Max((idx - 1) * gantt.RowHeight, 0));
  }
}

Suresh S [Syncfusion]
Replied On June 4, 2015 09:40 AM

Hi Nick,

We are currently analyzing on any workaround feasibility for requirement. Hence, We will update by tomorrow

Regards,

Suresh S


Suresh S [Syncfusion]
Replied On June 5, 2015 09:08 AM

Hi Nick,

We have analyzed your query and achieved your requirement of bringing specific record in to view. We have prepared a sample based on this, please download from below location,

Let us know in case of any query.

Regards,
Suresh S


Attachment: GridTreeControl_Sample_5a91decc.zip

Suresh S [Syncfusion]
Replied On June 10, 2015 09:03 AM

Hi Nick,

Please ignore our previous update.

We have prepared a sample to bring specific record into view, please download from below location.

CodeSnippet:

RowColumnIndex rowcolumnindex = new RowColumnIndex();

            rowcolumnindex.RowIndex = Convert.ToInt16(txtbox.Text);

            this.GanttControl.GanttGrid.Model.TreeGrid.ScrollInView(rowcolumnindex);

            this.GanttControl.GanttGrid.Model.TreeGrid.CurrentCell.MoveTo(rowcolumnindex);

Note:

In the sample, when the ganttcontrol is loaded, initially a specific row should be selected and then we can input the row index in the user option to bring the record into view.

Please let us know in case of any query.

Regards,

Suresh S


Attachment: GanttControl_6404e168.zip

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.

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.

;