src/Misc/EFTools/DesignXmlCore/VirtualTreeGrid/UI/VirtualTreeControl.cs
/// <summary>
///     Helper routine to figure out if a given column object is a simple cell or a complex item.
/// </summary>
Helper routine to figure out if a given column object is a simple cell or a complex item.
Helper routine to figure out if a given column object is a simple cell or a complex item .
public static bool IsSimpleItem(VirtualTreeControl ctl, int baseRow, int nativeBaseColumn, int localColumn)
            {
                if (localColumn == 0)
                {
                    return false; 
                }
                var simpleCell = true;
                var tree = ctl.Tree;
                var info = tree.GetItemInfo(baseRow, nativeBaseColumn, false);
                var mcBranch = info.Branch as IMultiColumnBranch;
                if (mcBranch != null)
                {
                    var nativeColumn = nativeBaseColumn + localColumn;
                    var style = mcBranch.ColumnStyles(localColumn);
                    var colInfo = new VirtualTreeItemInfo();
                    switch (style)
                    {
                        case SubItemCellStyles.Expandable:
                            simpleCell = !info.Branch.IsExpandable(info.Row, localColumn);
                            break;
                        case SubItemCellStyles.Mixed:
                        case SubItemCellStyles.Complex:
                            colInfo = tree.GetItemInfo(baseRow, nativeColumn, true);
                            if (colInfo.Column == 0)
                            {
                                var columns = (0 == (info.Branch.Features & BranchFeatures.JaggedColumns))
                                                  ? mcBranch.ColumnCount
                                                  : mcBranch.GetJaggedColumnCount(info.Row);
                                if (!(colInfo.Branch.VisibleItemCount == 1 &&
                                      !colInfo.Branch.IsExpandable(0, 0) &&
                                      (localColumn < columns ||
                                       (null != (colInfo.Branch as IMultiColumnBranch) &&
                                        0 == tree.GetSubItemCount(baseRow, nativeColumn)))))
                                {
                                    simpleCell = false;
                                }
                            }
                            else if (style == SubItemCellStyles.Mixed)
                            {
                                goto case SubItemCellStyles.Expandable;
                            }
                            break;
                    }
                }
                return simpleCell;
            }
public static bool IsSimpleItem ( VirtualTreeControl ctl , int baseRow , int nativeBaseColumn , int localColumn ) { if ( localColumn == 0 ) { return false ; } var simpleCell = true ; var tree = ctl . Tree ; var info = tree . GetItemInfo ( baseRow , nativeBaseColumn , false ) ; var mcBranch = info . Branch as IMultiColumnBranch ; if ( mcBranch != null ) { var nativeColumn = nativeBaseColumn + localColumn ; var style = mcBranch . ColumnStyles ( localColumn ) ; var colInfo = new VirtualTreeItemInfo ( ) ; switch ( style ) { case SubItemCellStyles . Expandable : simpleCell = ! info . Branch . IsExpandable ( info . Row , localColumn ) ; break ; case SubItemCellStyles . Mixed : case SubItemCellStyles . Complex : colInfo = tree . GetItemInfo ( baseRow , nativeColumn , true ) ; if ( colInfo . Column == 0 ) { var columns = ( 0 == ( info . Branch . Features & BranchFeatures . JaggedColumns ) ) ? mcBranch . ColumnCount : mcBranch . GetJaggedColumnCount ( info . Row ) ; if ( ! ( colInfo . Branch . VisibleItemCount == 1 && ! colInfo . Branch . IsExpandable ( 0 , 0 ) && ( localColumn < columns || ( null != ( colInfo . Branch as IMultiColumnBranch ) && 0 == tree . GetSubItemCount ( baseRow , nativeColumn ) ) ) ) ) { simpleCell = false ; } } else if ( style == SubItemCellStyles . Mixed ) { goto case SubItemCellStyles . Expandable ; } break ; } } return simpleCell ; }
Helper routine to figure out if a given column object is a simple cell or a complex item.
Helper routine to figure out if a given column object is a simple cell or a complex item .
// items in the first column are never simple // Use a simple cell unless the item is expandable. An item // in an expandable column cannot have subitems, so // we will not need a column object for this purpose. // The data is provided by a different branch. The item is simple only // if the branch has one unexpandable item and no sub items.
ctl
VirtualTreeControl
baseRow
int
nativeBaseColumn
int
localColumn
int