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

Combobox selectedValue in datagrid is changed when scrolling datagrid #13751

Open
yaobiao131 opened this issue Nov 27, 2023 · 8 comments
Open
Labels

Comments

@yaobiao131
Copy link

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.
image

Environment

  • OS: Mac,Windows
  • Avalonia-Version: avalonia.11.1.999-cibuild0042398-beta

Additional context

Add any other context about the problem here.

@yaobiao131 yaobiao131 added the bug label Nov 27, 2023
@yaobiao131
Copy link
Author

yaobiao131 commented Nov 27, 2023

and If I modify the selected value of the combobox and then scroll it, the selected value will go to other rows.

@jpgarza93
Copy link

I am having the same issue

@jpgarza93
Copy link

jpgarza93 commented Nov 28, 2023

My current work around (i am using MVVM) is to check if selected index is -1. If so (for me) it means it was changed by the datagrid and not the user

set
 {
     if (value != -1)
     {
         _selectedIndex = value;
         OnPropertyChanged(nameof(SelectedIndex));
    }
 }

@yaobiao131
Copy link
Author

My current work around (i am using MVVM) is to check if selected index is -1. If so (for me) it means it was changed by the datagrid and not the user

set
 {
     if (value != -1)
     {
         _selectedIndex = value;
         OnPropertyChanged(nameof(SelectedIndex));
    }
 }

it work well, thanks

@timunie
Copy link
Contributor

timunie commented Nov 29, 2023

Can you attach a minimum sample please? We recently had a similar issue which was solved as a binding was simply wrong

@blueperspective
Copy link

blueperspective commented Nov 30, 2023

Same problem here, I tried to do a minimal repo sample DataGridTest.
You need to click "enrich" button to set the combobox values (did this because it mimics what I have on a bigger app) ;

What I get :

  • on first scroll, the 2 lines immediately after (and which were "hidden") have empty combobox selected value
  • after some scrolling, the first line loses its combobox value
  • some random lines loses combobox value while scrolling up and down several times
  • if I maximize the window, I lose combobox selected value on ~6 lines

I could not reproduce what I have on my bigger, which is the last 2-3 lines which changes SelectedValue every time I scroll them out and then in.

@timunie
Copy link
Contributor

timunie commented Dec 1, 2023

@blueperspective great sample 👍 Added it to our roll-up list.
@grokys

@EjiHuang
Copy link

EjiHuang commented Dec 25, 2024

It has been a year, is there any progress on this bug?
I found this solution and currently it works for me.

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

No branches or pull requests

5 participants