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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Moving the NodeImage to a different column

Thread ID:





141600 Dec 20,2018 01:58 AM UTC Dec 24,2018 12:19 PM UTC WPF 3
Tags: GanttControl
Nico van der Merwe
Asked On December 20, 2018 01:58 AM UTC


Can you please assist in moving the NodeImage  into is own column next to the TaskName?


Vignesh Ramesh [Syncfusion]
Replied On December 21, 2018 01:02 PM UTC

Hi Nico, 

Greetings from Syncfusion. 

We have analyzed your query to show the node images on right side of the cell. You can achieve this by customizing the ExpanderCellRenderer in GanttControl loaded event as per the below code snippet 

Code snippet: 
class GridCustomizationBehavior : Behavior<GanttControl> 
void AssociatedObject_Loaded(object sender, System.Windows.RoutedEventArgs e) 
   this.AssociatedObject.GanttGrid.Model.CellModels.Add("ExpanderCell", new GridCellModel<GridTreeExpanderCellRendererExtension>()); 
   this.AssociatedObject.GanttGrid.InternalGrid.ExpandGlyphType = GridTreeExpandGlyph.PlusMinus; 
   var getVisualStyleMethod = this.AssociatedObject.GanttGrid.InternalGrid.GetType().GetMethod("GetVisualStyle", BindingFlags.Instance | BindingFlags.NonPublic); 
   var visualStyle = getVisualStyleMethod.Invoke(this.AssociatedObject.GanttGrid.InternalGrid, new object[] { this.AssociatedObject.GanttGrid.InternalGrid.VisualStyle }); 
   var applyGridVisualStyleMethod = this.AssociatedObject.GanttGrid.InternalGrid.GetType().GetMethod("ApplyGridVisualStyle", BindingFlags.Instance | BindingFlags.NonPublic); 
   applyGridVisualStyleMethod.Invoke(this.AssociatedObject.GanttGrid.InternalGrid, new object[] { visualStyle }); 

public class GridTreeExpanderCellRendererExtension : GridTreeExpanderCellRendererExt 
    BitmapImage image = null; 
    public override void OnRenderText(DrawingContext dc, RenderCellArgs rca, GridRenderStyleInfo style) 
       if (image != null) 
           if (textRectangle.Width > style.TextMargins.Left) 
               textRectangle.Width -= (image.Width + style.TextMargins.Left / 4); 
               textRectangle.Width = 0; 
    protected override Rect ClipNodeImage(Rect cellRect, double imageWidth, double imageHeight, GridRenderStyleInfo style) 
        cellRect.X = cellRect.Width + style.TextMargins.Left - imageWidth; 
       // Here you can set the cellRect.X position for set the image in right side 
       cellRect.Width = imageWidth - 2; 
       cellRect.Height = GridControl.Model.RowHeights.DefaultLineSize - style.TextMargins.Top - style.TextMargins.Bottom + 1; 
       if (imageHeight < cellRect.Height) 
           cellRect.Y += (cellRect.Height - imageHeight) / 2; 
           cellRect.Height = imageHeight; 
       return cellRect; 

We have modified our sample browser sample to achieve the same. Please find it from the below link. 


Please let us know if you have any other queries. 

Vignesh R

Nico van der Merwe
Replied On December 23, 2018 04:24 AM UTC


Thank you for the information provided, but I woul like to put it in its own seperate column like the is completed and Risk columns in the image.


Muneesh Kumar G [Syncfusion]
Replied On December 24, 2018 12:19 PM UTC

Hi Nico, 
Thanks for an update. 
We have achieved your requirement by using DataBoundTemplate column as per the below code snippet. 
Code Snippet: 
In GanttControl loaded: 
void AssociatedObject_Loaded(object sender, System.Windows.RoutedEventArgs e) 
GridTreeColumn imageColumn = new GridTreeColumn 
    MappingName = "ImageSource1", 
    HeaderText = "Image", 
    Width = 100, 
    StyleInfo = new GridStyleInfo 
        CellType = "DataBoundTemplate", 
        CellItemTemplateKey = "ImageCell" 
/// Inserting the custom image columns to GanttGrid(Table) 
this.AssociatedObject.GanttGrid.Columns.Insert(2, imageColumn); 
In XAML:  
    <local:ColorConverter x:Key="ColorConveter" /> 
    <DataTemplate x:Key="ImageCell"> 
        <Image Height="30" Width="30" Source="{Binding CellBoundValue, Mode=TwoWay}" /> 
We have modified our sample to achieve the same. Please find it from the below link. 
Hope it helps.  
Muneesh Kumar G.  


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon