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

Use UnboundRow in Gantt grid

Hi everyone,
I'm trying to add unbound rows to my GanttGrig as shown in the Essential Studio WPF example 'UnboundRow' for Tree Grid. I've successfully added the rows to the GanttGrid, but they're stuck below the last element instead of being fix at the bottom of the grid. Now this may be the default behavior, but when I scroll down the rows disapear on the bottom of the control instead of be always displayed. This is the code I'm using:

this.AssociatedObject.GanttGrid.InternalGrid.UnboundRowPosition = Position.Bottom;

this.AssociatedObject.GanttGrid.InternalGrid.UnboundRowsCount = 3;

this.AssociatedObject.GanttGrid.InternalGrid.QueryCellInfo += InternalGrid_QueryCellInfo;

this.AssociatedObject.GanttGrid.InternalGrid.QueryCoveredRange += InternalGrid_QueryCoveredRange;


void InternalGrid_QueryCoveredRange(object sender, GridQueryCoveredRangeEventArgs e)

{

  var rowcolIndex = e.CellRowColumnIndex;

  if (rowcolIndex.ColumnIndex >= 1)

  {

     var unboundPos = this.AssociatedObject.GanttGrid.InternalGrid.ResolveIndexToUnboundRowPosition(rowcolIndex.RowIndex);

     if (unboundPos >= 0 && unboundPos < this.AssociatedObject.GanttGrid.InternalGrid.UnboundRowsCount)

     {

         e.Range = new Syncfusion.Windows.Controls.Cells.CoveredCellInfo(rowcolIndex.RowIndex, 1, rowcolIndex.RowIndex, this.AssociatedObject.GanttGrid.InternalGrid.Model.ColumnCount - 1);

         e.Handled = true;

      }

   }

}

void InternalGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

{

  if (e.Style.Tag != null && e.Style.Tag.Equals("UnboundRow") && e.Style.ColumnIndex == 1)

  {

     int total = GetViewModel.Planning.SelectMany(p => p.SubItems).Where(p => p.IsPlanningVisible).Count();

     var unboundPos = this.AssociatedObject.GanttGrid.InternalGrid.ResolveIndexToUnboundRowPosition(e.Style.RowIndex);

     if (unboundPos == 0)

        e.Style.CellValue = "_attivi : " + total;

     else if (unboundPos == 1)

        e.Style.CellValue = "_magazzino : " + 3;

     else if (unboundPos == 2)

        e.Style.CellValue = "_archivio: " + 3;

     e.Style.Background = new SolidColorBrush(GridUtil.GetXamlConvertedValue<Color>("#FFA9C1DE"));

     e.Style.Foreground = new SolidColorBrush(GridUtil.GetXamlConvertedValue<Color>("#FF1E395B"));

     e.Style.ReadOnly = true;

  }

}


The code is for the most part took from the example behavior class, and I've tryed both with and without .InternalGrid, amI doing something wrong? Or the GanttControl is just not meant to have UnboundRows?

Cheers

Antoine


3 Replies

SG Sridharan Gajendran Syncfusion Team October 19, 2016 09:58 AM UTC

Hi Antoine, 
 
Thanks for contacting Syncfusion Support. 
 
We have achieved your requirements by using FooterRows property in the InternalGrid which always displays the required number of rows to be displayed at the bottom of the GanttGrid. Please find the sample in the below location for further reference. 
 
Regards, 
Sridharan 




NW Nyx Wallace October 19, 2016 11:42 AM UTC

Hi Sridharan,
Thank's for your answare, I tryed your example and it works fine, but when I move it to my program it generates an exception. When the program reach this line of code

this.AssociatedObject.GanttGrid.InternalGrid.FooterRows = 3;

I get this System.ArgumentOutOfRangeException

An exception of type 'System.ArgumentOutOfRangeException' occurred in Syncfusion.GridCommon.Wpf.dll but was not handled in user code

Additional information: out of range 0 to 2

 with message:

out of range 0 to 2
Nome parametro: index
Valore effettivo: -2.

Do you have any idea on what is causing it?

Regards
Antoine


SG Sridharan Gajendran Syncfusion Team October 20, 2016 09:15 AM UTC

Hi Antoine, 

Please share the below details regarding the reported issue. It will be helpful for us to proceed further.

1)  The full stack trace details.
2)   If possible, a simple sample based on your application along with the replication procedure or else just your application.  
 
 
Regards,   
Sridharan   


Loader.
Up arrow icon