Esempio n. 1
0
        public int GetColumnSpan(object control)
        {
            if (control == null)
            {
                throw new ArgumentNullException(nameof(control));
            }

            if (IsStub)
            {
                return(_stub.GetColumnSpan(control));
            }
            else
            {
                IArrangedElement element = LayoutEngine.CastToArrangedElement(control);
                return(TableLayout.GetLayoutInfo(element).ColumnSpan);
            }
        }
Esempio n. 2
0
 public int GetRow(object control)
 {
     if (control == null)
     {
         throw new ArgumentNullException(nameof(control));
     }
     if (IsStub)
     {
         return(_stub.GetRow(control));
     }
     else
     {
         IArrangedElement       element    = LayoutEngine.CastToArrangedElement(control);
         TableLayout.LayoutInfo layoutInfo = TableLayout.GetLayoutInfo(element);
         return(layoutInfo.RowPosition);
     }
 }
Esempio n. 3
0
        private void SetCellPosition(object control, int row, int column, bool rowSpecified, bool colSpecified)
        {
            if (IsStub)
            {
                if (colSpecified)
                {
                    _stub.SetColumn(control, column);
                }

                if (rowSpecified)
                {
                    _stub.SetRow(control, row);
                }
            }
            else
            {
                IArrangedElement element = LayoutEngine.CastToArrangedElement(control);
                if (element.Container is not null)
                {
                    TableLayout.ClearCachedAssignments(TableLayout.GetContainerInfo(element.Container));
                }

                TableLayout.LayoutInfo layoutInfo = TableLayout.GetLayoutInfo(element);
                if (colSpecified)
                {
                    layoutInfo.ColumnPosition = column;
                }

                if (rowSpecified)
                {
                    layoutInfo.RowPosition = row;
                }

                LayoutTransaction.DoLayout(element.Container, element, PropertyNames.TableIndex);
                Debug.Assert(!colSpecified || GetColumn(element) == column, "column position shoule equal to what we set");
                Debug.Assert(!rowSpecified || GetRow(element) == row, "row position shoule equal to what we set");
            }
        }
Esempio n. 4
0
 public void SetColumnSpan(object control, int value)
 {
     if (value < 1)
     {
         throw new ArgumentOutOfRangeException(nameof(value), string.Format(SR.InvalidArgument, "ColumnSpan", (value).ToString(CultureInfo.CurrentCulture)));
     }
     if (IsStub)
     {
         _stub.SetColumnSpan(control, value);
     }
     else
     {
         IArrangedElement element = LayoutEngine.CastToArrangedElement(control);
         // LayoutInfo.SetColumnSpan() throws ArgumentException if out of range.
         if (element.Container != null)
         {
             TableLayout.ClearCachedAssignments(TableLayout.GetContainerInfo(element.Container));
         }
         TableLayout.GetLayoutInfo(element).ColumnSpan = value;
         LayoutTransaction.DoLayout(element.Container, element, PropertyNames.ColumnSpan);
         Debug.Assert(GetColumnSpan(element) == value, "column span should equal to the value we set");
     }
 }