DataContext of ribbon Backstage gets set to null

Ribbon for WPF Forum

Posted 11 years ago by Ulrich Bürgi
Version: 13.1.0581
Platform: .NET 4.5
Environment: Windows 7 (64-bit)

I have a ribbon backstage which uses data binding to to populate the properties of its backstage items. My view currently looks as follows:

<actiproControls:Backstage  x:Class="PrismApplicationPrototype.Modules.Backstage.BackstageView"
                    d:DataContext="{d:DesignInstance Type=my:BackstageViewModel}"
                    d:DesignHeight="300" d:DesignWidth="300"

    <actiproControls:BackstageTab Header="{Binding Test}"/>

    <actiproControls:Button Label="{Binding Test}"
                            Command="{Binding CloseApplicationCommand}"
                            KeyTipAccessText="X" />

 And the corresponding view model: 

public class BackstageViewModel
    private ICommand closeApplicationCommand;
    public ICommand CloseApplicationCommand
        get { return this.closeApplicationCommand ?? (this.closeApplicationCommand = new DelegateCommand(CloseApplication)); }

    private void CloseApplication()

    public string Test { 
        get { return "Test"; }


Now, as soon as I click on the File button in the ribbon, which will show the Backstage, the Backstage's DataContext is changed and set to null. You can see this when subscribing the the Backstage's DataContextChanged event. Hence, in the running application the Backstage items have no labels or commands associated.

To test whether my bindings are OK I wrapped the Backstage into a Group inside of a Ribbon Tab. When doing this, the DataContext is not changed and the bindings work as expected. Of course this is not the proper place to put a Backstage...

// DataContext of the Backstage gets set to  null. Bindings break.
//ribbon.ApplicationMenu = backstage;

// DataContext is kept. Bindings work.
var tab = new Tab {Label = "Tab hosting Backstage"};
var tabGroup = new Group();

[Modified 11 years ago]

Comments (1)

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Ulrich,

The Backstage (when used from the File menu) is normally opened within an adorner on the root window.  So it's not within the visual tree hierarchy of the Ribbon.  Thus, we have logic in the code that creates Backstage to bind its DataContext to the Ribbon's DataContext.  So it should be getting whichever DataContext that Ribbon has.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.