Example #1
0
        private UIDataGridRow generateRow(object item, int rowIndex)
        {
            UIDataGridRow row = new UIDataGridRow()
            {
                RowIndex = rowIndex
            };
            var   height   = rowIndex * RowHeight;
            int   curIndex = 0;
            float pading   = 5f;
            float curWidth = pading;

            if (rowIndex == 0)
            {
                headerRow = new UIDataGridRow();
            }
            foreach (var col in _columns)
            {
                row.Cells.Add(new UIDataGridCell {
                    Text   = getPropertyValue(item, col.DisplayMember),
                    Column = curIndex,
                    Row    = rowIndex,
                    Frame  = new RectangleF(curWidth, height, col.Width, RowHeight),
                });
                if (rowIndex == 0)
                {
                    headerRow.Cells.Add(new UIDataGridCell()
                    {
                        Frame  = new RectangleF(curWidth, height, col.Width, RowHeight),
                        Column = curIndex,
                        Text   = col.Header
                    });
                }

                curWidth += col.Width + pading;
                row.MaxY  = height * (rowIndex + 1);
                row.MaxX  = curWidth;
                curIndex++;
            }
            return(row);
        }
Example #2
0
        private UIDataGridRow generateRow(object item, int rowIndex)
        {
            UIDataGridRow row = new UIDataGridRow() { RowIndex = rowIndex};
            var height = rowIndex * RowHeight;
            int curIndex = 0;
            float pading = 5f;
            float curWidth = pading;
            if(rowIndex == 0)
                headerRow = new UIDataGridRow();
            foreach(var col in _columns)
            {
                row.Cells.Add(new UIDataGridCell{
                    Text = getPropertyValue(item,col.DisplayMember),
                    Column = curIndex,
                    Row  = rowIndex,
                    Frame = new RectangleF(curWidth,height,col.Width,RowHeight),
                });
                if(rowIndex == 0)
                    headerRow.Cells.Add(new UIDataGridCell() {
                        Frame= new RectangleF(curWidth,height,col.Width,RowHeight),
                        Column = curIndex,
                        Text = col.Header});

                curWidth += col.Width + pading;
                row.MaxY = height * (rowIndex + 1);
                row.MaxX = curWidth;
                curIndex ++;
            }
            return row;
        }