This is a migrated thread and some comments may be shown as answers.

Can you disable a RadRibbonBackstageItem button?

6 Answers 215 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 17 May 2018, 05:30 PM
What I’m trying to do is to have a backstage button (Save) and a backstage list item (Save As) be disabled when there is no document open in the application. I’ve been able to bind IsEnabled successfully for the list item, but not the button. Is it possible to bind the IsEnabled property of a RadRibbonBackstageItem to a Boolean when that backstage item is functioning as a button (e.g. IsSelectable= “False”)? Even if I manually set the IsEnabled property to False rather than trying to bind it, the results are still an active “button”.

6 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 18 May 2018, 08:45 AM
Hello Chris,

I tested the IsEnabled button and its seem to work properly on my side. I created a new WPF application and used the following XAML to test this.
<telerik:RadRibbonView>
    <telerik:RadRibbonView.Backstage>
        <telerik:RadRibbonBackstage>                   
            <telerik:RadRibbonBackstageItem Header="Save" IsSelectable="False" IsEnabled="False"/>
        </telerik:RadRibbonBackstage>
    </telerik:RadRibbonView.Backstage>
</telerik:RadRibbonView>
Can you please try this also on your side and let me know if I am missing something?

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Chris
Top achievements
Rank 1
answered on 18 May 2018, 10:24 PM

Martin,

Thanks for the speedy response. If I stripped the item down to just Header, IsSelectable and IsEnabled everything worked as expected, including binding it to a Boolean on the view model. So we've got something else in our solution that's causing the trouble. The only remaining difference seems to be the command, so I'll start by digging in there. Appreciate the help in ruling out one part of the puzzle.

0
Zhenyan
Top achievements
Rank 1
answered on 11 Jun 2019, 05:19 PM
Hi Chris, did you figure out what the difference the command makes in your case? I run into the same issue. Thanks.
0
Zhenyan
Top achievements
Rank 1
answered on 11 Jun 2019, 09:40 PM

Martin,

 

Can you test the IsEnabled button and see if it works properly on your side?
Thank you,

<telerik:RadRibbonView>
    <telerik:RadRibbonView.Backstage>
        <telerik:RadRibbonBackstage>                   
            <telerik:RadRibbonBackstageItem Header="Save" IsSelectable="False" IsEnabled="False" Command="{Binding SaveCommand}"/>
        </telerik:RadRibbonBackstage>
    </telerik:RadRibbonView.Backstage>
</telerik:RadRibbonView>

0
Martin Ivanov
Telerik team
answered on 12 Jun 2019, 12:45 PM
Hello Zhenyan,

Now I see what could be the original issue. The Command property usually interferes with the IsEnabled of the corresponding element. If the command's CanExecute handler returns False (the command is not allowed) the IsEnabled is automatically set to False. If CanExecute returns True, IsEnabled is also True. 

To resolve this, use the CanExecute command handler instead of IsEnabled.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Zhenyan
Top achievements
Rank 1
answered on 12 Jun 2019, 02:33 PM
Martin,
Thanks for the speedy response. It works. Thanks
Tags
RibbonView and RibbonWindow
Asked by
Chris
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Chris
Top achievements
Rank 1
Zhenyan
Top achievements
Rank 1
Share this question
or