April 22, 2025, 03:09:08 AM

See more Support incidents in our old archived forum.

Author Topic: Fexy gantt scroll postion after reload -problem  (Read 20808 times)

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Fexy gantt scroll postion after reload -problem
« on: March 15, 2016, 01:14:56 PM »
Problem with scroll position when reloading data.
I can reproduce the problem with PerformanceSampleHierData project:
Number of rows: 25. Load Gantt.
Scroll down few lines. Reload Gantt.
Scroll position changes after reload.
Regards,
Ilkka Paloheimo

ForumAdmin

  • Administrator
  • Jr. Member
  • *****
  • Posts: 96
Re: Fexy gantt scroll postion after reload -problem
« Reply #1 on: March 16, 2016, 10:26:17 PM »
Ilkka,

This is a known issue we fixed since our last official release. We sent you an updated assembly. Please confirm fix.

Thanks
RQ Support

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Re: Fexy gantt scroll postion after reload -problem
« Reply #2 on: March 17, 2016, 11:05:10 AM »
Did not fix my problem!
I changed the dll in PreformanceSampleHierData projoct, too. Did not fix the problem there either.
Regards, Ilkka

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Fexy gantt scroll postion after reload -problem
« Reply #3 on: March 17, 2016, 02:29:28 PM »
Ilkka,

We have also tried your steps to reproduce the reported issue but unfortunately we couldn't.
Please take a look at the video clip that we sent to you and help us to reproduce it.


Thanks,
- Raja.

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Re: Fexy gantt scroll postion after reload -problem
« Reply #4 on: March 17, 2016, 03:19:43 PM »
In the video the view scrolls to top after reload. If you have say 200 or 1000 rows the view stays where it was before reload. Problem exists only if there are less than 30 rows. My purpose is to keep the same lines on the view after reload what I had before reload.
Regards, Ilkka

ForumAdmin

  • Administrator
  • Jr. Member
  • *****
  • Posts: 96
Re: Fexy gantt scroll postion after reload -problem
« Reply #5 on: March 18, 2016, 01:30:56 PM »
Ilkkka,

Ok, so you want to retain the scroll position after the reload? (We thought for some reason that the grid and chart were going out of sync). We will get back to you shortly on this.

Thanks
RQ Support

Karthikeyan

  • RQ Members
  • Newbie
  • *
  • Posts: 5
Re: Fexy gantt scroll postion after reload -problem
« Reply #6 on: March 23, 2016, 01:01:15 PM »
Ilkkka,

Here is the way to retain the scroll position after the reload. You have to add some namespaces, those are given below. To use those namespaces you should include the
UIAutomationProvider.dll and UIAutomationTypes.dll assemblies.

NameSpaces :
Code: [Select]
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;

Code :
Code: [Select]
........
/// <summary>
/// Getting the scroll percent value of the chart.
/// </summary>
/// <returns></returns>
private double GetVerticalScrollPercent()
{
    AutomationPeer p;

    if (this.fxgantt.UseChartVirtualization)
        p = FrameworkElementAutomationPeer.FromElement(this.fxgantt.GanttChart.VerticalScrollViewerElement) ?? FrameworkElementAutomationPeer.CreatePeerForElement(this.fxgantt.GanttChart.VerticalScrollViewerElement);
    else
        p = FrameworkElementAutomationPeer.FromElement(this.fxgantt.GanttChart.VerticalScrollViewerElement) ?? FrameworkElementAutomationPeer.CreatePeerForElement(this.fxgantt.GanttChart.VerticalScrollViewerElement);

    var chartScrollProvider = p.GetPattern(PatternInterface.Scroll) as IScrollProvider;

    return chartScrollProvider.VerticalScrollPercent;

}

/// <summary>
/// The types of scrolling directions
/// </summary>
private enum ScrollDirection
{
    Up,
    Down,
    Right,
    Left
}

/// <summary>
/// Setting the scroll value to the grid.
/// </summary>
/// <param name="grid"></param>
/// <param name="direction"></param>
/// <param name="vp"></param>
private void SetVerticalScrollPercent(DataGrid grid, ScrollDirection direction, double vp)
{
    // Get the scroll provider of the grid.
    AutomationPeer p1 = FrameworkElementAutomationPeer.FromElement(grid) ?? FrameworkElementAutomationPeer.CreatePeerForElement(grid);
    IScrollProvider scrollProvider = p1.GetPattern(PatternInterface.Scroll) as IScrollProvider;

    // Scroll.
    switch (direction)
    {
        case ScrollDirection.Up:
        case ScrollDirection.Down:
            if (scrollProvider.VerticallyScrollable)
            {
                scrollProvider.SetScrollPercent(System.Windows.Automation.ScrollPatternIdentifiers.NoScroll, vp);
            }

            break;
        case ScrollDirection.Left:
        case ScrollDirection.Right:
            if (scrollProvider.HorizontallyScrollable)
            {
                scrollProvider.SetScrollPercent(vp, System.Windows.Automation.ScrollPatternIdentifiers.NoScroll);
            }

            break;
    }
}

private void LoadGantt_Click(object sender, RoutedEventArgs e)
{
    // Getting the scroll percent value.
    double vp = this.GetVerticalScrollPercent();

    this._ticks = DateTime.Now.Ticks;
    this.fxgantt.ItemsSource = SampleProjectData.GetSampleData((int)this.rowCountUD.Value);
    this.fxgantt.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Loaded, new Action(delegate()
    {
        // Update log right after the UI thread is free.
        long elapsed = TimeComputingUtils.ToUtcKind(DateTime.Now).Ticks - this._ticks;
        this.UpdateLoadLog((int)this.rowCountUD.Value, elapsed);
    }));

    // Setting the scroll percent to the grid.
    DataGrid grid = ((DataGrid)this.fxgantt.FlexyTable.AsControl);
    this.SetVerticalScrollPercent(grid, ScrollDirection.Up, vp);
}
..........


Thanks,
- Karthik.

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Re: Fexy gantt scroll postion after reload -problem
« Reply #7 on: April 04, 2016, 08:44:24 AM »
Ok. I had to add an async sleep (400 ms) before SetVerticalScrollPercent so that the gantt view has time to update before repositioning. A disturbing detail is that the view blinks up and down when updating data.
Thanks,
-Ilkka

Karthikeyan

  • RQ Members
  • Newbie
  • *
  • Posts: 5
Re: Fexy gantt scroll postion after reload -problem
« Reply #8 on: April 04, 2016, 11:48:04 AM »
Ilkka,

 Can you tell us why you had to use the timer? If we understand this issue better we can come up with a better fix.

Thanks,
-Karthikeyan K.

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Re: Fexy gantt scroll postion after reload -problem
« Reply #9 on: April 05, 2016, 08:36:07 AM »
Before staring repositioning I have to wait until all layout updates are done by gantt control. Otherwise gantt will override my repositioning.
- Ilkka

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Fexy gantt scroll postion after reload -problem
« Reply #10 on: April 06, 2016, 03:48:53 PM »
Ilkka,

We are looking on this, will update you soon.


Thanks,
- Raja.

Karthikeyan

  • RQ Members
  • Newbie
  • *
  • Posts: 5
Re: Fexy gantt scroll postion after reload -problem
« Reply #11 on: April 07, 2016, 12:21:49 PM »
Hi Ilkka,
 
We spent some time with the Reference sample we have trying to reset the ItemsSource when the gantt is vertically scrolled and at no point does the gantt "reset" the scroll position that was set using the SetVerticalScrollPosition. Does this happen in some very specific scenario? If so, can you tell us when? And what .NET framework are you working with 4.0 or 4.5?.


Thanks,
- Karthikeyan

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Re: Fexy gantt scroll postion after reload -problem
« Reply #12 on: April 18, 2016, 06:56:03 AM »
In my software this (vertical scroll position lost) happens only if I have 3 parents and less than about 140 rows. If I have only 1 parent or I have more than 140 rows the software works fine.  I have tested this with several different databases. In PreformanceSampleHierData sample the problem existed if less than 30 rows. I use .NET framework 4.5.

Regards, Ilkka

Karthikeyan

  • RQ Members
  • Newbie
  • *
  • Posts: 5
Re: Fexy gantt scroll postion after reload -problem
« Reply #13 on: April 19, 2016, 01:17:41 PM »
Ilkka,
 
We tested our Performance sample with this many number of rows, but didn't see this issue. Could you let us know what we might be missing?. Please find out the video in www.radiantq.com/External/Support/Hotellinx/Ilkka.avi

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Re: Fexy gantt scroll postion after reload -problem
« Reply #14 on: April 23, 2016, 12:09:24 PM »
I have data expanded when running the sample.
-Ilkka