MSCE Enable/disable Ribbon items

We use MSCE update 16 for a huge project with 100+ custom applications.

These applications are launched by means of the various items on a custom ribbon.

After long searching and tons of trial/error, I managed to create an XML file that configures the ribbon and is loaded at startup by means of the MS_RIBBONXML entry in the configuration file.

Each item should be enabled/disabled and hidden/shown in accordance to the user's permisions and the type of DGN that is loaded.

On startup, the first MDL application is loaded (by means of the MS_DGNAPPS configuration) and that MDL calls mdlCExpression_publishFunction for 2 functions that have an integer as input parameter and return a boolean.

Each item in the XML has the following parameters:


Where "x" of course depends on the specific item within the ribbon.

Everything works great except for 1 thing:

The "checkEnabled" function is never called. Not even when checkVisible returns true. I also tried removing the <ShowExpression> entry, but nothing changes.

When configuring "checkVisible" for the FeatureAspect entry, I still get the very same result: the function is not called.

It looks like the <FeatureAspect> is never evaluated.

As usual, I'm quite sure I'm missing something trivial but so far I have no clue.

Parents Reply
  • Something changed in the meantime?

    Well ... yes. My knowledge of the ribbon configuration increased ;-)

    From today perspective I think I was wrong at that time (the true is that my list what to test in ribbon definition is still quite long, but I do not plan to reserve time until there is real requirement).

    Do you know by chance how to enable/disable an item within the ribbon?

    When you read ribbon definition (and also Command Framework) documentation, you can find that "Enable Expression" exists.

    Also, in ribbon xsd, EnableExpression is defined 4x for different ribbon controls.

    Preferably with a named expression

    You do not share too many details, so it's not clear what mechanism you use to invoke a feature (functionality) related to particular ribbon control.

    When you use UserKeyinCommand, you can define <EnableExpression>, e.g. this way (when Named Expresion is used to control enable/disable state):

    <EnableExpression>[Session]Session.EvalNEAsBool("<NE name>", true)</EnableExpression>

    With regards,


    Answer Verified By: Robert Kock