Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataGrid: expose row index #15909

Merged
merged 2 commits into from
Jun 6, 2024
Merged

DataGrid: expose row index #15909

merged 2 commits into from
Jun 6, 2024

Conversation

rabbitism
Copy link
Contributor

@rabbitism rabbitism commented Jun 4, 2024

What does the pull request do?

Make DataGridRow.Index public get-able.

What is the current behavior?

It's hard to show row number.

What is the updated/expected behavior with this PR?

User can use below binding to show row index.

<DataGridTextColumn Header=" " Binding="{Binding $parent[DataGridRow].Index}" Width="60" x:DataType="local:Country" />

8fc15485cb3ce96686af2e6f0b845ee

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

I think no.

Obsoletions / Deprecations

GetIndex method is obsoleted, should be replaced by Index property

Fixed issues

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048779-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@cla-avalonia
Copy link
Collaborator

cla-avalonia commented Jun 4, 2024

  • All contributors have signed the CLA.

@rabbitism
Copy link
Contributor Author

@cla-avalonia agree

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048787-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@stevemonaco
Copy link
Contributor

What are the performance implications if you insert or remove the first row of a 100k row DataGrid? Does this cause 100k PropertyChanged events for Index? Or only for the rows that are presently materialized via virtualization?

@maxkatz6
Copy link
Member

maxkatz6 commented Jun 5, 2024

It should affect only rows that are currently materialized.

@maxkatz6 maxkatz6 added this pull request to the merge queue Jun 6, 2024
Merged via the queue into AvaloniaUI:master with commit 7413434 Jun 6, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants