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

Use UnboundRow in Gantt grid

Thread ID:

Created:

Updated:

Platform:

Replies:

126765 Oct 17,2016 10:36 AM Oct 20,2016 05:15 AM WPF 3
loading
Tags: GanttControl
Nyx Wallace
Asked On October 17, 2016 10:36 AM

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


Sridharan Gajendran [Syncfusion]
Replied On October 19, 2016 05:58 AM

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 



Nyx Wallace
Replied On October 19, 2016 07:42 AM

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

Sridharan Gajendran [Syncfusion]
Replied On October 20, 2016 05:15 AM

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   


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

;