Please start using our more robust New Forum, we have put this old forum in archive mode. Thanks.


Welcome Guest Search | Active Topics | Log In

Tag as favorite
How to persist EndTime ?
d.laumaille
#1 Posted : Tuesday, July 15, 2014 4:52:55 AM

Posts: 4
Location: Lorient, France

Hello,

in my project, I'd like to persist StartTime, Effort, and EndTime...
StartTime and Effort are binded so that's easy... But how to do for the EndTime ? It must be saved in the database.

Currently, my gantt WPF code looks like :
Code:
<gantt:GanttControl Grid.Row="1" x:Name="ganttControl"
         UseChartVirtualization="True" SyncRowBackgrounds="True"
     IDBinding="{Binding Pk_Tsk}"
     NameBinding="{Binding Lbc_Tsk, Mode=TwoWay}"
     DescriptionBinding="{Binding Lbl_Tsk, Mode=TwoWay}"
     StartTimeBinding="{Binding Dh_Deb_Plg, Mode=TwoWay}"
     EffortBinding="{Binding Eff_Plg, Converter={StaticResource effort2Timespan}}"
     AdjustDurationOnAssignment="True"
     IndentLevelBinding="{Binding Num_Lvl, Mode=TwoWay}"
     PredecessorIndicesBinding="{Binding Prev_Tsk, Mode=TwoWay}"
     ProgressPercentBinding="{x:Null}"
     SortOrderBinding="{Binding Id_Order, Mode=TwoWay}"
     AssignedResourcesBinding="{Binding Fk_Res_Plg, Mode=TwoWay}"
     ResourceIDBinding="{Binding Pk_Res}"
     ResourceNameBinding="{Binding Lbc_Res}">
</gantt:GanttControl>


Could I add a binding on the EndTime ? Or should I listan to some event to change my EndTime programmatically ?
I'm a little bit lost...
Raja - RadiantQ
#2 Posted : Tuesday, July 15, 2014 12:31:51 PM

Posts: 314

d.laumaille,

Yes, you can listen for the PropertyChanged event of Activity and you can update the EndTime value like this,
Code:
public partial class MainPage : Page
    this.ganttControl.ItemsSource = taskItems;
    // Updating the StartTime and Endtime to all Activities
    foreach (RadiantQ.Windows.Controls.Gantt.View.IActivityView activityView in this.ganttControl.ActivityViews)
    {
        this.SyncEndTimes(activityView.Activity);
        // Subscribe PropertyChanged Event if StarTime and Effort gets changed to Update the StartTime and Endtime.
        activityView.Activity.PropertyChanged += Activity_PropertyChanged;
    }
}

private void Activity_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
    if (e.PropertyName == "StartTime" || e.PropertyName == "Effort")
    {
        this.SyncEndTimes(sender as IActivity);
    }
}
// Updating the Endtime in DataSource
private void SyncEndTimes(IActivity activity)
{
    // Get the bound DataSource from Activity
    object boundData = (activity as DataBoundActivity).DataSource;
           
    // Updating the EndTime value of bound data code comes here.
}
You can refer the <InstallFolder>/Samples/ProjectGantt/Misc/TrackingEndTimeInDataSource sample to get more information about updating EndTime.
Thanks & Regards,
Rajagopal.
Tag as favorite
Forum Jump  
Please Email support@radiantq.com for any issues

ugg boots outlet cheap ugg sale ugg boots clearance ugg boots sale ugg boots cheap ugg boots for women uggs for cheap ugg shops cheap ugg boots cheap uggs Official Ugg Outlet ugg Store Buy Cheap UGGs ugg boots uk ugg boots usa ugg Online uggs on sale ugg outlets cheap ugg boot Discount UGG Boots discount uggs