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

Customized Table -> DataTemplate -> Bind whole Task Item

Hi,
1. i´m trying to customize the GanttGrid as shown in your expample "Customized Table". The issue is, I need the whole bound task item (not only the 'CellBoundValue') in the converter because I need to calculate a value which is then representing the color. 
Is this possible?


2. Is it possible to change the appearance of the parent Tasks including the RowHeader?

thanks in advance,
Kamil Kosek

3 Replies

RA Rachel A Syncfusion Team December 9, 2015 12:36 PM UTC

Hi Kamil,

Thanks for contacting Syncfusion support.

Query1:I need the whole bound task item (not only the 'CellBoundValue') in the converter because I need to calculate a value which is then representing the color. 

We are unable to get the task item in grid row CellItemTemplate. We can get the task item from note collection by corresponding row index and set the color for the row in QueryCellInfo event as in the below code example.

[C#]

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

        void InternalGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

        {

            var allnodes = (sender as GridTreeControlImpl).Nodes;

            if (e.Cell.RowIndex == 5)

                e.Style.Background = Brushes.Red;            
        }



Query2: Is it possible to change the appearance of the parent Tasks including the RowHeader?

We can change the appearance of the parent task in the following ways.

1.We can set style for all the parent task using LevelStyles property in GanttGrid .This property will not change the appearance for row header, to set style for row header we have to set RowHeaderStyle property as in the below code example,

[C#]
this.AssociatedObject.GanttGrid.InternalGrid.RowHeaderStyle = new GridStyleInfo() { Background = new SolidColorBrush(Colors.Gray) };

this.AssociatedObject.GanttGrid.LevelStyles.Add(new GridStyleInfo() { Background = new SolidColorBrush(Colors.Gray) });


2. We can  set the style for the row in QueryCellInfo event based on the row index. Here the row header also will be set the same style by using below code example,

[C#]

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

        void InternalGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

        {

              if (e.Cell.RowIndex == 5)

                e.Style.Background = Brushes.Red;            
        }



Regards,
Rachel. A



KK Kamil Kosek December 9, 2015 12:41 PM UTC

Hi Rachel,
thanks for the excellent response, I didn´t tried it yet, but it looks very promising.
Thanks :)


RA Rachel A Syncfusion Team December 9, 2015 12:43 PM UTC

Hi Kamil,

Thanks for the update.

Please let us know if you have any query.

Regards,
Rachel.A

Loader.
Up arrow icon