w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How do I control a WPF 4.5 Ribbons contextual tab visibility by availability of a particular control within a Prism (+ MEF) view using MVVM?

One possible solution would be the following:

Considering that the Region is defined on a ContentControl, you could ask the Region for the ActiveViews, which in this case there would be only one, that is, the only Active View that is being shown.

Therefore, you would not need the Focus/LostFocus events. The Region would take care of updating its ActiveViews list each time you navigate to a different Tab or View.

Finally, in order to decide whether to show or hide the GridTools, you should evaluate if the Region's ActiveView contains a Grid control or not. You could achieve this by looking at UserControl's Content property.

I hope this helped you, Regards.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.