HandyOrg / HandyOrg/HandyControl

Datagrid header 多余的margin问题

Open Beginner friendly
#1,809 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
7.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

DataGrid的Template里面的两个Margin硬编码有问题。DataGridBaseStyle和DataGrid.Small都受这个影响。

Steps to reproduce the bug

给header换个颜色就能重现了。
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="Blue"
</Style>
</DataGrid.ColumnHeaderStyle>

下面这两个Margin="0,0,0,6"会让header下面出现gap,当Header的背景色都是灰色的时候看不出来,但是换了颜色后,就很明显了。第一行和Header之间有个灰色的gap。
<hc:SimplePanel Margin="0,0,0,6" ...
<DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Margin="0,0,0,6" ..

Image
Expected behavior

换header颜色时,下面不要有灰色gap

Screenshots

No response

NuGet package version

None

IDE

No response

Framework type

No response

Windows version

No response

Additional context

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the DataGrid template for DataGridBaseStyle and DataGrid.Small, then inspect the SimplePanel and DataGridColumnHeadersPresenter margins shown in the issue. Reproduce the problem by applying a blue header background. Done means the header background reaches the first row without the visible gray gap in both affected styles.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.