Esempio n. 1
0
        private DataTemplate?LayoutTemplate(BuildTreeNodeViewModel buildNode, FrameworkElement element)
        {
            if (buildNode == null)
            {
                return(null);
            }

            // display groups with the least possible grouping. Therefore start with the smallest grouping (level 4) and extend to the biggest (level 1)
            // in other words, for 3 nested groups, the layout for a fourth group level is not needed. However this fourth group WOULD not be level 4, it would be level 1.
            // Therefore with 3 groups, display the DataTemplates 4, 3, 2.
            var distanceToDeepestLevel = buildNode.MaxTreeDepth - buildNode.CurrentTreeLevelDepth;
            var levelToDisplay         = Math.Max(1, 4 - distanceToDeepestLevel); // 4 is the maximum of supported depths, beyond that display every group the same as level 1

            switch (levelToDisplay)
            {
            default:
                return(element.TryFindResource("FirstLevelTemplate") as DataTemplate);

            case 2:
                return(element.TryFindResource("SecondLevelTemplate") as DataTemplate);

            case 3:
                return(element.TryFindResource("ThirdLevelTemplate") as DataTemplate);

            case 4:
                return(element.TryFindResource("FourthLevelTemplate") as DataTemplate);
            }
        }
 public Brush Convert(BuildTreeNodeViewModel node)
 {
     if (node.ShouldColorByStatus)
     {
         return(Convert(node.BuildStatus));
     }
     return(GetBrush(DefaultBrushKey));
 }
Esempio n. 3
0
 private DataTemplate?DisplayTemplate(BuildTreeNodeViewModel node, FrameworkElement element)
 {
     return(DataTemplateByName(node, element));
 }