void SetUnboundCellData(object sender, TreeListUnboundColumnDataEventArgs e) { TaskObject task = e.Node.Content as TaskObject; string FieldName = e.Column.FieldName; if (task != null) { switch (FieldName) { case StartDateFieldName: task.StartDate = (DateTime)(e.Value ?? DateTime.MinValue); break; case EndDateFieldName: task.EndDate = (DateTime)(e.Value ?? DateTime.MinValue); break; case StateFieldName: task.State = (State)e.Value; break; default: break; } } }
void GetUnboundState(TreeListUnboundColumnDataEventArgs e, TreeListNode treeListNode) { TaskObject task = treeListNode.Content as TaskObject; if (task != null) { e.Value = task.State; return; } List <State> statesList = new List <State>(); CollectBoundStates(e.Node, statesList); if (statesList.Contains(States.DataSource[1]) || (statesList.Contains(States.DataSource[0]) && statesList.Contains(States.DataSource[2]))) { e.Value = States.DataSource[1]; } else if (statesList.Contains(States.DataSource[0])) { e.Value = States.DataSource[0]; } else if (statesList.Contains(States.DataSource[2])) { e.Value = States.DataSource[2]; } }
void GetColumnData(object sender, TreeListUnboundColumnDataEventArgs e) { if (e.IsSetData) { SetUnboundCellData(sender, e); } else { GetUnboundCellData(sender, e); } }
///// <summary> ///// Handles the OnCustomUnboundColumnData event of the ComposedObjectView control. ///// </summary> ///// <param name="sender">The source of the event.</param> ///// <param name="e">The <see cref="TreeListUnboundColumnDataEventArgs" /> instance containing the event data.</param> /// <summary> /// Handles the OnCustomUnboundColumnData event of the TreeView control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="TreeListUnboundColumnDataEventArgs" /> instance containing the event data.</param> private void TreeView_OnCustomUnboundColumnData(object sender, TreeListUnboundColumnDataEventArgs e) { var comp = (e.Node.Content as IDomainObject); if (comp == null) { return; } if (e.IsGetData) { e.Value = comp.GetValue(e.Column.FieldName); } else { comp.SetValue(e.Column.FieldName, e.Value); RefreshParents(e.Node); } }
void GetUnboundCellData(object sender, TreeListUnboundColumnDataEventArgs e) { switch (e.Column.FieldName) { case StartDateFieldName: e.Value = GetUnboundStartDate(e, e.Node); break; case EndDateFieldName: e.Value = GetUnboundEndDate(e, e.Node); break; case StateFieldName: GetUnboundState(e, e.Node); break; default: break; } }
DateTime GetUnboundEndDate(TreeListUnboundColumnDataEventArgs e, TreeListNode treeListNode) { TaskObject task = treeListNode.Content as TaskObject; DateTime value = DateTime.Now; DateTime tempValue; if (task != null) { value = task.EndDate; } else { value = DateTime.MinValue; foreach (TreeListNode item in treeListNode.Nodes) { tempValue = GetUnboundEndDate(e, item); if (tempValue > value) { value = tempValue; } } } return(value); }