RadButton- not disabled

1 Answer 155 Views
Button
Daniel
Top achievements
Rank 1
Silver
Bronze
Daniel asked on 28 Mar 2022, 11:00 AM

Hi,

The button not disabled in my side.
      <telerik:RadButton  AutomationId="button" Text="Back" HorizontalOptions="End" VerticalOptions="Center" Command="{Binding BackCommand}" BackgroundColor="{DynamicResource PrimaryColor}"  Margin="15" IsEnabled="True"/>
         

Thanks,

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 28 Mar 2022, 03:30 PM

Hi Daniel,

The RadButton in your code has IsEnabled="True", this is why the button is not disabled. 

Consequential Investigation

Just in case you you were rushing to explain the problem and made a mistake in your explanation, I have tested using IsEnabled=False anyways.

<VerticalStackLayout Spacing="5" 
                        VerticalOptions="Center" 
                        HorizontalOptions="Center">
    <telerik:RadButton x:Name="RadButton1"
                        Text="RadButton"
                        BackgroundColor="Green" 
                        Clicked="RadButton1_Clicked"/>
    <CheckBox IsChecked="True" 
                CheckedChanged="CheckBox_CheckedChanged" />
</VerticalStackLayout>

    private void CheckBox_CheckedChanged(object sender, CheckedChangedEventArgs e)
    {
        RadButton1.IsEnabled = !RadButton1.IsEnabled;
    }

    private void RadButton1_Clicked(object sender, EventArgs e)
    {
        Console.WriteLine($"RadButton clicked");
    }

Everything is working as expected. Therefore, I am closing this case as not reproducible.

Testing Note

Do not use appearance to determine if a button is disabled or not when you have explicitly set a BackgroundColor. You will want to click the button to see if the button is operational.

 

Important - Understanding Scope

This is extremely important to understand... The RadButton is built on top of the .NET MAUI Button control. This means if you are having an issue, please first test your perceived behavior with the MAUI Button component before opening an Issue on our Forums.

That way you know where the problem originates from.

Test 1
<telerik:RadButton  AutomationId="button" Text="Back" HorizontalOptions="End" VerticalOptions="Center" Command="{Binding BackCommand}" BackgroundColor="{DynamicResource PrimaryColor}"  Margin="15" IsEnabled="True"/>

Test 2
<Button  AutomationId="button" Text="Back" HorizontalOptions="End" VerticalOptions="Center" Command="{Binding BackCommand}" BackgroundColor="{DynamicResource PrimaryColor}"  Margin="15" IsEnabled="True"/>

Result: Same Behavior is Observed on Both Tests  - Everything is working as Expected

  • If the problem is only happening with RadButton, you can open an Issue in the Telerik forums.
  • If the problem also presents itself with Button, then you will want to look at MAUI's Issues and see if someone else has already reported it. If noone else has reported it yet, the prepare a full reproducible implementation and open a new Issue (do not link back to a 3rd party forum).

Regards,
Lance | Manager Technical Support
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Daniel
Top achievements
Rank 1
Silver
Bronze
commented on 29 Mar 2022, 07:13 AM

Since I do not see change in background I used this code.

   <Style TargetType="telerik:RadButton">
               
                <Style.Triggers >
                    <Trigger TargetType="telerik:RadButton" Property="IsEnabled" Value="false" >
                      <Setter Property="BackgroundColor" Value="Gray" />
                    </Trigger>
                </Style.Triggers>
            </Style>

Tags
Button
Asked by
Daniel
Top achievements
Rank 1
Silver
Bronze
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or