示例#1
0
 private void Node_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "ActualStartDate" || e.PropertyName == "ActualEndDate")
     {
         if (Node.ActualStartDate.HasValue && Node.ActualEndDate.HasValue)
         {
             var actualItem = new GanttActualItem();
             actualItem.ParentRow = this;
             actualItem.ItemContent = Node;
             actualItem.ToolTipContentTemplate = this.ParentPanel.ParentGanttChart.ToolTipContentTemplate;
             actualItem.Node = Node;
             actualItem.IsFinished = Node.PercentComplete == 100;
             actualItem.Visibility = IsShowActualItem ? Visibility.Visible : Visibility.Hidden;
             ItemsPresenter.Children.Add(actualItem);
         }
     }
 }
示例#2
0
        private void GenerateItems()
        {
            if (Node == null)
            {
                ItemsPresenter.Children.Clear();
            }
            else if (!ItemsValid)
            {
                ItemsValid = true;
                ItemsPresenter.Children.Clear();

                GanttItem item = null;

                if (Node.Children.Count == 0)
                    item = new GanttItem();
                else
                    item = new HeaderGanttItem();

                item.GapBackgroundBrush = this.GapBackgroundBrush;
                item.GapBorderBrush = this.GapBorderBrush;
                item.ItemContent = this.Node;
                item.ToolTipContentTemplate = this.ParentPanel.ParentGanttChart.ToolTipContentTemplate;
                item.ItemLeftTemplate = this.ParentPanel.ParentGanttChart.ItemLeftTemplate;
                item.ItemRightTemplate = this.ParentPanel.ParentGanttChart.ItemRightTemplate;
                item.ItemTopTemplate = this.ParentPanel.ParentGanttChart.ItemTopTemplate;
                item.ItemBottomTemplate = this.ParentPanel.ParentGanttChart.ItemBottomTemplate;
                item.ParentRow = this;
                item.Node = Node;
                ItemsPresenter.ItemShadow.StartDate = Node.StartDate;
                ItemsPresenter.ItemShadow.EndDate = Node.EndDate;
                ItemsPresenter.Children.Add(item);
                ItemsPresenter.Children.Add(ItemsPresenter.ItemShadow);

                if (Node.ActualStartDate.HasValue && Node.ActualEndDate.HasValue)
                {
                    var actualItem = new GanttActualItem();
                    actualItem.ParentRow = this;
                    actualItem.ItemContent = Node;
                    actualItem.ToolTipContentTemplate = this.ParentPanel.ParentGanttChart.ToolTipContentTemplate;
                    actualItem.Node = Node;
                    actualItem.IsFinished = Node.PercentComplete == 100;
                    actualItem.Visibility = IsShowActualItem ? Visibility.Visible : Visibility.Hidden;
                    ItemsPresenter.Children.Add(actualItem);
                }

            }
        }