Toolbar enable/disable based on active window

I hope I can address this clearly, but I am not a native English speaker so please excuse that.

I am developing an enterprise software in C# and WPF. The software have one main window with menus and toolbars. The GUI should look like Visual Studio GUI. In the software is huge amount of menus and toolbars, and the objects are over 2.000 (WPF forms, reports and such).

I need some solution about how the buttons and menu items should be disabled or enabled, and some times a new toolbar appear in the main window based on what object is open.

For example if you have a basic form opened, the print button in the toolbar should be disabled (you don’t print out forms) but enabled if active object is report (you of course print out reports). Also if you have report opened which is more then 1 page the arrow buttons who gives user opportunity to open next page, previous page, go to first page or last pages should be enabled, and the buttons should be disabled if the report is just one page or the active object is form.

I know in fact how to achieve this, but I can’t think about some generic solution. The only thing that I think about is to determine manual what buttons should be disabled or enabled on each object (and of course that is an hectic work when the objects are more than 2.000 and the buttons over 50.

I need to get my minds open to develop some generic solution, so there should be no need to determine manual what is disabled or enabled. The idea is that only thing that is necessary is to inherit some interface, class, list or whatever who determine automatically what buttons should be enabled and what should be disabled, based on the type of the object, the assets on the object and more.

The key issue is to develop something who is no need to implement manual on each and every object. But how to do it - I am not sure and I hope someone could help me to open my mind on a new approach. If there is some bulletin or forum that describe the approach I would be very grateful if someone can link it with that question.

.NET Foundation Website | Blog | Projects | Code of Conduct