-
Notifications
You must be signed in to change notification settings - Fork 706
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
[Android] Button.IsEnabled binding inside a ListViewItem is not always updating correctly #12748
Comments
Thanks for the report. We'll take a look, but note that the enabled state is linked to the |
If it can help, in the case of the sample provided, here's the implementation of public class Command<T> : ICommand
{
private readonly Action<T> _act;
public Command(Action<T> act)
{
_act = act;
}
public event EventHandler? CanExecuteChanged;
public bool CanExecute(object? parameter) => true;
public void Execute(object? parameter)
{
_act((T)parameter);
}
} |
@ramezgerges Let's validate if #12884 may be fixing this issue as well. |
This is a template pooling issue. The workaround is |
I wasn't able to get further than identifying the root cause :'( |
An update of this topic, wrapping the We've been having similar issues (#11600) with the DataContext being set directly on the root element of a DataTemplate that is causing issues. In this case, it seems to be related to the reuse of the container and the way the DataContext is set to the root element. @takla21 could you try this workaround and let us know? |
@jeromelaban the workaround is indeed working, even on our app |
Current behavior
When refreshing the list of Items binded to
ListView.ItemsSource
in which includes a button that gets enabled/disabled depending on the Item content. The button is not changing its enabled/disabled state according to theItemsSource
actual values.Items that has
IsEnabled = true
should've been enabled from the above gif.Expected behavior
Button enabled/disable state inside a
ListViewItem
should always reflect its binding.How to reproduce it (as minimally and precisely as possible)
Workaround
Wrapping the
Button
inside aGrid
worksWorks on UWP/WinUI
Yes
Environment
Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
NuGet package version(s)
4.10.0-dev.395
Affected platforms
Android
IDE
Visual Studio 2022
IDE version
17.6.1
Relevant plugins
No response
Anything else we need to know?
It's a regression that was not happening on uno 4.6.44
The text was updated successfully, but these errors were encountered: