コード例 #1
0
 private void RowDef_RowExpanding(object sender, RowDef row)
 {
     foreach (RowDef child in row.Children)
     {
         child.IsVisible = true;
     }
     OnPropertyChanged(nameof(Display));
 }
コード例 #2
0
 private void RowDef_RowCollapsing(object sender, RowDef row)
 {
     foreach (RowDef child in row.Children)
     {
         if (row.IsExpanded.HasValue && row.IsExpanded.Value)
         {
             RowDef_RowCollapsing(this, child);
         }
         child.IsVisible = false;
     }
     OnPropertyChanged(nameof(Display));
 }
コード例 #3
0
        private RowDef InitRow(RowDef parent, IEnumerable <string> values)
        {
            RowDef row = new RowDef(parent)
            {
                IsVisible = false,
                Cells     = new ObservableCollection <string>(values),
            };

            row.RowCollapsing += RowDef_RowCollapsing;
            row.RowExpanding  += RowDef_RowExpanding;

            return(row);
        }
コード例 #4
0
        private IEnumerable <RowDef> IterateTree(RowDef parent)
        {
            if (!parent.IsVisible)
            {
                yield break;
            }
            yield return(parent);

            foreach (RowDef child in parent.Children)
            {
                foreach (RowDef r in IterateTree(child))
                {
                    yield return(r);
                }
            }
        }
コード例 #5
0
        private int LoadData(IList <RowDef> srce, IEnumerable <XElement> rows, RowDef parent)
        {
            int count = 0;

            foreach (XElement r in rows)
            {
                var colVals = new List <string>
                {
                    r.Attribute("Val1").Value,
                    r.Attribute("Val2").Value
                };

                RowDef row = InitRow(parent, colVals);
                srce.Add(row);
                ++count;

                int children = LoadData(row.Children, r.Elements("Row"), row);
                if (children > 0)
                {
                    row.IsExpanded = false;
                }
            }
            return(count);
        }
コード例 #6
0
 public RowDef(RowDef parent)
     : this()
 {
     Parent = parent;
 }