コード例 #1
0
        public static TView Col <TView>(this TView view, IConvertible col) where TView : View
        {
            int colIndex = col.ToInt();

            if (colIndex != 0)
            {
                view.SetValue(Grid.ColumnProperty, colIndex);
            }
            return(view);
        }
コード例 #2
0
        public static TView Row <TView>(this TView view, IConvertible row) where TView : View
        {
            int rowIndex = row.ToInt();

            if (rowIndex != 0)
            {
                view.SetValue(Grid.RowProperty, rowIndex);
            }
            return(view);
        }
コード例 #3
0
        public static TView Row <TView>(this TView view, IConvertible first, IConvertible last) where TView : View
        {
            int rowIndex = first.ToInt();
            int span     = last.ToInt() - rowIndex + 1;

            if (rowIndex != 0)
            {
                view.SetValue(Grid.RowProperty, rowIndex);
            }
            if (span != 1)
            {
                view.SetValue(Grid.RowSpanProperty, span);
            }
            return(view);
        }
コード例 #4
0
        public static TView Col <TView>(this TView view, IConvertible first, IConvertible last) where TView : View
        {
            int colIndex = first.ToInt();

            if (colIndex != 0)
            {
                view.SetValue(Grid.ColumnProperty, colIndex);
            }

            int span = last.ToInt() + 1 - colIndex;

            if (span != 1)
            {
                view.SetValue(Grid.ColumnSpanProperty, span);
            }

            return(view);
        }
コード例 #5
0
        public static TView RowCol <TView>(this TView view, IConvertible firstRow = null, IConvertible firstCol = null, IConvertible lastRow = null, IConvertible lastCol = null) where TView : View
        {
            int firstRowIndex = firstRow.ToInt();

            if (firstRowIndex != 0)
            {
                view.SetValue(Grid.RowProperty, firstRowIndex);
            }

            int firstColIndex = firstCol.ToInt();

            if (firstColIndex != 0)
            {
                view.SetValue(Grid.ColumnProperty, firstColIndex);
            }

            if (lastRow != null)
            {
                int lastRowIndex = lastRow.ToInt();
                int rowSpan      = lastRowIndex + 1 - firstRowIndex;
                if (rowSpan != 1)
                {
                    view.SetValue(Grid.RowSpanProperty, rowSpan);
                }
            }

            if (lastCol != null)
            {
                int lastColIndex = lastCol.ToInt();
                int colSpan      = lastColIndex + 1 - firstColIndex;
                if (colSpan != 1)
                {
                    view.SetValue(Grid.ColumnSpanProperty, colSpan);
                }
            }

            return(view);
        }