RadiantQ WPF Gantt
Milestones
Previous Topic  Next Topic 

Milestone Customization using TaskColorsBinding


The TaskColorsBinding property in the GanttControl discussed earlier can also be used to customize the look and feel of a Milestone type task (with Effort = 0).


To begin with set the above property with a Converter:


this.ganttControl.TaskColorsBinding = new Binding("DataSource.SomeProperty") { Converter = new CustomTaskColorProvider() };


Then in the converter, specify a custom shape and color for the Milestone:


    public class CustomTaskColorProvider : IValueConverter

    {

        #region IValueConverter Members


        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

        {

            IActivity activity = parameter as IActivity;

            SomeType someTypeValue = value as SomeType;



            YourBoundTaskType task = ((DataBoundActivity)activity).DataSource as YourBoundTaskType;


            if (task.Effort == TimeSpan.Zero)

            {

                   PointCollection pc = new PointCollection();

                   LinearGradientBrush barFillBrush = null;

                   SolidColorBrush barStrokeBrush = null;


               // Fill the above based on activity, task and someTypeValue.
               return new TaskSpecificLook()

                   {

                       MilestonePoints = pc,

                       TaskItemBarFill = barFillBrush,

                       TaskItemBarStroke = barStrokeBrush

                       // Other customization options:

                       //TaskItemProgressFill = brush3,

                   };

            }

            else

                return null;

        }



Please take a look at the "ProjectGantt\Appearance\GanttControlCustomAppearance" sample where this is fully illustrated.


Here is a screenshot of the milestones from the above sample



� RadiantQ 2009 - 2019. All Rights Reserved.