GanttControl - reorder columns and disable chart editing

I have a few questions that the documentation doesn't provide answers for.

1) The Finish column is before the Start column in the grid.  How do I reorder for it to be the opposite?
2) How do I disable chart editing? I'm able to disable the grid by setting GanttGrid.ReadOnly = true



1 Reply

SS Sridevi Sivakumar Syncfusion Team July 15, 2021 01:40 PM UTC

Hi Jon Sinsel,

Query: The Finish column is before the Start column in the grid.  How do I reorder for it to be the opposite

We can achieve your requirement by setting the finish date mapping before the start date mapping  as per the below code snippet


[XAML]:
 
         <sync:GanttControl
...>
 
            <sync:GanttControl.TaskAttributeMapping> 
                <sync:TaskAttributeMapping  TaskIdMapping="Id" 
                                                TaskNameMapping="Name" 
                                                FinishDateMapping="EndDate" 
                                                StartDateMapping="StDate" 
                                                ChildMapping="ChildTask" 
                                                DurationMapping="Duration"                             
                                                ProgressMapping="Complete" 
                                                PredecessorMapping="Predecessor"/> 
            </sync:GanttControl.TaskAttributeMapping> 
            <!--Style applied for Gantt Node --> 
 ... 
        </sync:GanttControl> 

Screenshot:
 


Query: How do I disable chart editing? I'm able to disable the grid by setting GanttGrid.ReadOnly = true

We can achieve it by customizing the Gantt node, header node, milestone tempalte. In this customization, we have disabled the node thumbs and ellipse.

[NodeStyle.XAML]
 
    <Style TargetType="chart:GanttNode" 
               x:Key="TaskNode"> 
        <Setter Property="HorizontalAlignment" 
                    Value="Left" /> 
        <Setter Property="Template"> 
            <Setter.Value> 
                <ControlTemplate TargetType="chart:GanttNode"> 
                    <Canvas Height="11"> 
                     ... 
                       <Thumb Cursor="SizeAll" IsEnabled="False" 
                                           x:Name="PART_DragDropThumb" 
                                           Grid.Column="0" 
                                           Grid.ColumnSpan="3"> 
                                    <Thumb.Template> 
                                        <ControlTemplate> 
                                            <Border Background="Transparent" /> 
                                        </ControlTemplate> 
                                    </Thumb.Template> 
                                </Thumb> 
 
                                <Border x:Name="ProgressBorder" 
                             ….> 
                                    <Thumb Cursor="SizeWE" IsEnabled="False" 
                                               x:Name="PART_ProgressThumb" 
                                              
                                    </Thumb> 
                                </Border> 
 
                                <Thumb Cursor="ScrollE" IsEnabled="False" 
                                         ... 
                                </Thumb> 
 
                                <Thumb Cursor="ScrollW" 
                                           MaxWidth="6" IsEnabled="False" 
                                         
                                   </Thumb> 
 
                            </Grid> 
                        </Border> 
                    </Canvas> 
                   
               </Setter.Value> 
        </Setter> 
    </Style> 

Please have a sample from the below link
 
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-333257566

Let us know if you need any further assistance.


Regards,
Sridevi S.
 
  
 


Loader.
Up arrow icon