maui
maui copied to clipboard
Button IsEnabled="{Binding IsBttEnabled}" - Not working - but IsVisible works
Description
Hi, I m not able to change the IsEnabled State of my Button. But if i change it with IsVisible it all works.
My xaml Page:
<Button Command="{Binding BttWeiterCommand}" IsEnabled="{Binding IsBttWeiterEnabled}" Grid.Row="1" Grid.Column="1" HorizontalOptions="Center" Text="Weiter" WidthRequest="200"/> <Button Command="{Binding BttZureckCommand}" Grid.Row="1" Grid.Column="0" HorizontalOptions="Center" Text="Zureck" WidthRequest="200"/>
My ViewModel:
//[ObservableProperty] //also not work with CommunityToolkit
public bool IsBttEnabled{ get; set; } = true;
[RelayCommand]
async Task BttWeiter()
{
try
{
if(IndexSelectedItem < List_InfoBoxen.Count-1)
IndexSelectedItem++;
if (List_InfoBoxen[IndexSelectedItem].IsSkipButtonVisible)
IsBttEnabled= false;
else
IsBttEnabled= true;
//...
}
catch (Exception ex)
{
Console.WriteLine("Exception: " + ex);
}
finally
{
IsBttEnabled= false; //just for testing - NOT working for IsEnabled
}
}
[RelayCommand]
void BttZureck()
{
try
{
if (IndexSelectedItem > 0)
IndexSelectedItem--;
if (List_InfoBoxen[IndexSelectedItem].IsSkipButtonVisible)
IsBttEnabled= false;
else
IsBttEnabled= true;
}
catch (Exception ex)
{
Console.WriteLine("Exception: " + ex);
}
IsBttEnabled= false; //just for testing - NOT working for IsEnabled
}
Steps to Reproduce
-
Add new MAUI Page
-
add my code to the MAUI page
-
add my button codes
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
Windows 10 Home, 19044.1889
Did you find any workaround?
No response
Relevant log output
No response
Duplicate of https://github.com/dotnet/maui/issues/7377
IsEnabled is broken for Windows
oh man. thx for the info.
Duplicate of #7377