Skip to content

feat(grid): Copy cell menu for untruncated value#55

Merged
haidang1810 merged 1 commit into
mainfrom
dev/haidang
Apr 30, 2026
Merged

feat(grid): Copy cell menu for untruncated value#55
haidang1810 merged 1 commit into
mainfrom
dev/haidang

Conversation

@haidang1810
Copy link
Copy Markdown
Contributor

Summary

Long-text cells in the data grid visually truncate at MAX_CELL_DISPLAY_CHARS (80 chars), so the TextBlock's underlying Text property only contains the prefix + ellipsis. Ctrl+C / drag-select therefore only copied the visible chars — the rest of the value was unreachable from the grid.

Added a Copy cell item at the top of the right-click context menu that reads the full value from data_.rows directly and ships it to the clipboard.

Implementation

  • Each cell TextBlock now stamps Tag(int32 colIndex).
  • RightTapped on the row walks OriginalSource up the visual tree, picks up the cell's column index from the Tag, and stashes it in contextCol_.
  • Menu Opening gates the new item on selectedRow_ >= 0 && contextCol_ >= 0.
  • CopyCellToClipboard writes data_.rows[selectedRow_][colName] (or literal NULL for null cells) to a DataPackage.

Test plan

  • Right-click long-text cell → context menu shows "Copy cell" at top
  • Click "Copy cell" → paste in notepad → full value (not truncated)
  • Null cell → paste yields "NULL"
  • Build Debug x64 clean

Cells visually truncate at MAX_CELL_DISPLAY_CHARS, so a TextBlock-
level Ctrl+C only saw the visible prefix. Added a 'Copy cell' item
at the top of the data-grid context menu that pulls the FULL value
from data_.rows directly — works regardless of how aggressively the
cell is clipped for layout.

Wire-up:
- Each cell TextBlock now stamps Tag(int32 colIndex).
- RightTapped on the row walks OriginalSource up the visual tree to
  find the cell TextBlock and stash its column in contextCol_.
- Menu Opening gates the item on (selectedRow_ >= 0 && contextCol_ >= 0).
- CopyCellToClipboard reads data_.rows[selectedRow_][colName] and
  ships a DataPackage with the full string. NULL sentinel renders
  as the literal 'NULL' so paste targets see something.
@haidang1810 haidang1810 merged commit 2272bd4 into main Apr 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant