Avalonia
Avalonia copied to clipboard
Fix nth child selector in data grid header
What does the pull request do?
Attempt at getting nth child selectors to work with data grid column headers.
What is the current behavior?
If you add or remove columns :nth-child and :nth-last-child applies to the wrong element.
What is the updated/expected behavior with this PR?
That nth-child and nth-last-child applies to the expected elements after adding or removing columns.
Fixed issues
Fixes #14695
@appel1 for debugging, you can also use src/Samples/Sandbox
. You may need to add a reference to DataGrid project. Just fyi.
You can test this PR using the following package version. 11.2.999-cibuild0047602-alpha
. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]
@timunie Thanks for that, made things easier.
But why was the PR closed when I added another commit to it?
Not sure if this is the correct approach, but as far as I can tell it works after these changes.
You can test this PR using the following package version. 11.2.999-cibuild0047608-alpha
. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]
You can test this PR using the following package version. 11.2.999-cibuild0047630-alpha
. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]
Realized that taking visibility might be a bad idea. If you change visibility in the selector for example.
I'll check how this is handled elsewhere in Avalonia and update the PR.
I think nth child in CSS counts elements even if they are hidden.
Yes, nth child does count elements if they are hidden. The same goes with avalonia nth child, IIRC.
What about the hidden DataGridFillerColumn? Should that also be taken into account? So that nth-last-child(1) matches the filler column.
@cla-avalonia recheck
- [x] All contributors have signed the CLA.
You can test this PR using the following package version. 11.2.999-cibuild0047774-alpha
. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]
@cla-avalonia agree