Making Specific Tasks ReadOnly
You can also make certain tasks read-only by binding to some property values of the task. For example, you can make the tasks that are 100% complete, read-only as follows:
In XAML:
<gantt:GanttControl ......
IsTaskReadOnlyBinding="{Binding Activity.ProgressPercent, Converter={StaticResource readOnlySettingProvider}}"/>
And in the converter, return a bool:
// To prevent dependency connections or time-editing of tasks that are already 100% completed.
public class ReadOnlySettingProvider : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double progress = (double)value;
if (progress < 100)
return false;
else
return true;
}
....
}
Preventing Shifting of Specific Tasks in Chart
Some times you just want to prevent shifting of some tasks in the chart. For example, if a task's progress is > 0, you want to prevent shifting it.
You can do so by listening to the GanttControl's CanShiftTask event handler like this:
void ganttControl_CanShiftActivity(object sender, CancellableActivityEventArgs e)
{
e.Cancel = e.Activity.ProgressPercent > 0;
}
� RadiantQ 2009 - 2019. All Rights Reserved.