示例#1
0
文件: FGridView.cs 项目: mrange/fgrid
            public void Render(DrawingContext drawingContext, Vector offset, Size renderSize)
            {
                if (renderSize.AreaOf() <= 0)
                {
                    return;
                }

                var startingRow = FindFirstVisibleRow(offset);
                if (startingRow == null)
                {
                    return;
                }

                var end         = offset + renderSize.ToVector();
                var transform   = new TranslateTransform();

                for (
                        var currentRowIndex = startingRow.Value
                    ;       currentRowIndex < AvailableRows.Length
                    ;   ++currentRowIndex
                )
                {
                    var currentRow = AvailableRows[currentRowIndex];
                    if (currentRow == null)
                    {
                        continue;
                    }

                    if (currentRow.OffsetY > end.Y)
                    {
                        break;
                    }

                    transform.X = -offset.X;
                    transform.Y = -(offset.Y + currentRow.OffsetY);

                    drawingContext.PushTransform(transform);

                    currentRow.Render(drawingContext);

                    drawingContext.Pop();

                }
            }