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

Sorting issues on datagrid with user control as data template #17785

Open
giacarrea opened this issue Dec 16, 2024 · 2 comments
Open

Sorting issues on datagrid with user control as data template #17785

giacarrea opened this issue Dec 16, 2024 · 2 comments

Comments

@giacarrea
Copy link

Describe the bug

I have a datagrid with templated columns, one of which being a user control.

image

That user control doesn't seem to properly sort with the rest of the line:

grid sorting issue 1
grid sorting issue 2

Sample project demonstrating the issue:
Avalonia.Samples-main - gridbug.zip

To Reproduce

From the sample project, fiddle a few time with the tag column header sorting.

Expected behavior

No response

Avalonia version

11.2.2

OS

Windows

Additional context

No response

@giacarrea giacarrea added the bug label Dec 16, 2024
@giacarrea
Copy link
Author

The issue seem to stem from the fact that I'm adding the textboxes programmatically in the TagManagerUserControl UC. The column sorts correctly when using ItemsControl.

Avalonia.Samples-main - gridbug.zip
[^Demo project using itemscontrol]

@timunie
Copy link
Contributor

timunie commented Dec 17, 2024

Why do you need to add controls programatically? I highly suggest you use DataTemplates. If not, add them at least in OnDataContextChanged override to ensure correct DataContext is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants