Can you disable a RadRibbonBackstageItem button?

7 posts, 0 answers
  1. Chris
    Chris avatar
    4 posts
    Member since:
    Mar 2014

    Posted 17 May 2018 Link to this post

    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”.
  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2194 posts

    Posted 18 May 2018 Link to this post

    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.
  3. Chris
    Chris avatar
    4 posts
    Member since:
    Mar 2014

    Posted 18 May 2018 in reply to Martin Ivanov Link to this post

    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.

  4. Zhenyan
    Zhenyan avatar
    5 posts
    Member since:
    Jul 2017

    Posted 11 Jun in reply to Chris Link to this post

    Hi Chris, did you figure out what the difference the command makes in your case? I run into the same issue. Thanks.
  5. Zhenyan
    Zhenyan avatar
    5 posts
    Member since:
    Jul 2017

    Posted 11 Jun in reply to Martin Ivanov Link to this post

    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>

  6. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2194 posts

    Posted 12 Jun Link to this post

    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.
  7. Zhenyan
    Zhenyan avatar
    5 posts
    Member since:
    Jul 2017

    Posted 12 Jun in reply to Martin Ivanov Link to this post

    Martin,
    Thanks for the speedy response. It works. Thanks
Back to Top