feat(DataGrid): add pinned (sticky/frozen) column support#4671
Draft
feat(DataGrid): add pinned (sticky/frozen) column support#4671
Conversation
Agent-Logs-Url: https://github.com/microsoft/fluentui-blazor/sessions/5cdc49d8-9764-4339-b8fa-6f9a9454f9e3 Co-authored-by: vnbaaij <1761079+vnbaaij@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
vnbaaij
April 2, 2026 20:36
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
📖 Description
Implements column pinning for
FluentDataGrid(#4652). Columns can be frozen to the left or right edge of the grid and remain visible during horizontal scrolling.API surface
New
Pinparameter onColumnBase<TGridItem>(applies toPropertyColumn,TemplateColumn,SelectColumn):New enum:
DataGridColumnPin—None(default) /Left/Right.Validation (throws
ArgumentException)Width(e.g."150px").fr,%, and other units are rejected.This prevents "floating" pinned columns in the middle of the grid.
Internal changes
ColumnBase.razor.csPinpublic parameter;PinOffsetPxinternal propertyFluentDataGrid.razor.csValidateAndComputePinnedColumns()+ValidatePinnedColumnConstraints()called fromFinishCollectingColumns();ParsePixelWidth()helperFluentDataGridCell.razor.cscol-pinned-left/col-pinned-rightCSS classes; inlineposition: sticky,left/rightoffset,z-index: 1(data cells)FluentDataGrid.razor.css--fluent-data-grid-pinned-background), separator borders, z-index floors for header/sticky-header intersectionsFluentDataGrid.razor.tsUpdatePinnedColumnOffsets()recalculates live pixel offsets from rendered header widths; called onInitialize()and every resize pointer-move🎫 Issues
Closes #4652
👩💻 Reviewer Notes
ValidatePinnedColumnConstraints()inFluentDataGrid.razor.cs— this is where the ordering rules are enforced.UpdatePinnedColumnOffsets()inFluentDataGrid.razor.tsusesoffsetWidthin Grid mode andclientWidthin Table mode — consistent with how the existing resize logic elsewhere in that file measures columns.--fluent-data-grid-pinned-backgroundCSS custom property can be set per-grid to theme the pinned cell background independently of the rest of the grid.overflow-x: autowrapper.📑 Test Plan
13 new tests in
FluentDataGridPinnedColumnTests.razor:Pin == Nonecol-pinned-left/col-pinned-right) and inline style (position: sticky; left/right: 0px)Width→ArgumentExceptionWidth(e.g.1fr) →ArgumentExceptionArgumentExceptionArgumentExceptionArgumentExceptionArgumentExceptionAll 3099 existing tests continue to pass.
✅ Checklist
General
Component-specific
MCP Server
⏭ Next Steps
UpdatePinnedColumnOffsetsas a public JS interop method so host apps can trigger a re-sync after programmatic column visibility changes.left/rightoffsets are applied directly; verify visually in a full RTL demo once the component ships.