Close backstage view from within backstage view

4 posts, 0 answers
  1. Michael
    Michael avatar
    19 posts
    Member since:
    Aug 2014

    Posted 11 Oct 2015 Link to this post

    Hi all - me again :)

    Been making some good progress with the backstage view, but have hit another snag. We have defined the backstage view content as a DataTemplate, which allows us to use caliburn micro to inject views into the backstage view based on the items source (a list of menu item view models).

    I would like to be able to close the backstage view from within these views. Eg, clicking cancel on a form within the backstage should close the backstage view. Currently, only the root object can do so (via the BackstageOpen binding), but don't like the idea of propagating that expression down the chain.

    Any suggestions ? Basically, I want to be able to bind a cancel button to something that closes the backstage view.

  2. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 12 Oct 2015 Link to this post

    Hello Michael,

    The RadRibbonView exposes a command that could be executed while the BackstageIsOpen and it is a CloseBackstageCommand. You could use that command and directly bind the button in your xaml, here is an example of how to do that:
    <telerik:RadRibbonButton Command="{x:Static telerik:RibbonCommands.CloseBackstage}" Content="Close" />

     I hope this information helps.

    Kind regards,
    Kiril Vandov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Michael
    Michael avatar
    19 posts
    Member since:
    Aug 2014

    Posted 13 Oct 2015 in reply to Kiril Vandov Link to this post

    That's almost exactly what I want !

    On close, I want to do a bit of cleanup though, so I created a CompositeCommand that was made up of the ribbon command, as well as my own command. That doesn't seem to work however. Maybe the Prism composite command doesn't like combining a RoutedUICommand with a DelegateCommand ...

    I can't invoke the Ribbon command directly, as I don't know what the target is.

    Is there a way I can clean up while closing ?


     
  5. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 15 Oct 2015 Link to this post

    Hello Michael,

    The CloseBackstageCommand is a standard RoutedUICommand and as all RouterUICommand it can be intersected in the static constructor of you your application. Once you intersect it you can execute your own logic. Unfortunately as the RadRibbonBackstage is not aware of its RibbonView you cant access it and close the backstage. We can consider exposing a public method in the RadRibbonBackstage whcih can trigger close. Until such logic is implemented you could either create a CustomBackstage and make the command and cleanup logic there. Or you could use the ApplicationMenuOpenStateChanged event of the RadRibbonView and clean your code if the backstage is closed.

    I hope this information helps.

    Regards,
    Kiril Vandov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top