Open zoranivoclar opened 1 year ago
Creating a dynamic buttons in code behind makes the button disabled when the RelayCommand is used. Here is a example
var removeButton = new Button() { Content = "X", Command = new RelayCommand<int>(RemoveEntry), CommandParameter = index, };
then afterwards adding this button to a StackPanel the property isEnabled is always false (no matter how it's bound).
There is a workaround solution make it work First object initialize the button with IsEnabled =true, without setting the command
var removeButton = new Button() { Content = "X", IsEnabled = true, CommandParameter = index, };
afterwards just set the command
removeButton.Command = new RelayCommand<int>(RemoveEntry);
Hi! I have the same issue
I think you should ask question here https://github.com/CommunityToolkit/dotnet
Creating a dynamic buttons in code behind makes the button disabled when the RelayCommand is used. Here is a example
then afterwards adding this button to a StackPanel the property isEnabled is always false (no matter how it's bound).
There is a workaround solution make it work First object initialize the button with IsEnabled =true, without setting the command
afterwards just set the command