🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Toolbarmode
This page was created by Hans.karlsen on 2024-04-26. Last edited by Wikiadmin on 2026-07-29.

Toolbar mode lets you organise actions in an MDriven Turnkey ViewModel so that safe top-level navigation stays separate from actions that edit data or act on a selected nested item.

What toolbar mode changes

Toolbar mode is an optional MDriven Turnkey UI style. It reduces the left-side action area and gives each ViewModel a horizontal toolbar below the main menu.

The layout separates actions by both their target and their effect:

Action type Where it appears in toolbar mode Example
Top-level navigation that does not change data Left-side action area An action that opens another ViewModel for the current customer without editing the customer.
Root-level actions that change data, including navigation actions with side effects Horizontal toolbar below the main menu Save, Cancel, Edit (the ReadOnly switch), or an action that changes the current customer before navigating.
Actions on nested objects, such as rows in a grid Context menu for the selected object An action on an order line is available from that line's context menu rather than the ViewModel's top-level action area.

This separation makes the left-side area predictable: it is intended for ViewModel-top-level navigation with no side effects. Actions that can change data are kept out of that area.

Enable toolbar mode for one ViewModel

Use a TaggedValue when you want toolbar mode only on selected ViewModels.

  1. Open the ViewModel in MDriven Designer's ViewModel Editor.
  2. Select the ViewModel's top level.
  3. Add the TaggedValue Toolbar with the value true.
  4. Save the model and run the ViewModel in Turnkey.

For example, set Toolbar=true on an Order ViewModel to try the layout for order handling while other ViewModels retain their existing action layout.

Enable toolbar mode globally

Use the global setting when toolbar mode should be the default for your application.

  1. Add the class SysMDrivenMiscSettingsSingleton to the model and mark it as a Singleton.
  2. Add the Boolean attribute GlobalToolbarMode.
  3. Set GlobalToolbarMode to true on the singleton instance.
  4. Restart MDrivenServer. This setting is read when the system starts.
  5. Review ViewModels that need the previous layout and set Toolbar=false on their top-level ViewModel TaggedValue.

When GlobalToolbarMode=true, toolbar mode is used for every ViewModel except a ViewModel explicitly marked Toolbar=false.

GlobalToolbarMode ViewModel TaggedValue Toolbar Result
false or not enabled true Toolbar mode is enabled for that ViewModel.
true Not set Toolbar mode is enabled.
true false Toolbar mode is disabled for that ViewModel.

For the recognised settings class and its other server settings, see Documentation:SysMDrivenMiscSettingsSingleton.

Design actions for the layout

Toolbar mode uses the action's placement and whether MDriven can determine that the action changes data. The available action render positions are:

  • LeftSide
  • ContextMenu
  • ToolBarLeft
  • ToolBarRight

Configure and review actions in the Actions Editor. Keep actions aimed at the current ViewModel's root separate from actions aimed at objects displayed inside the ViewModel.

Keep safe navigation on the left

Put only non-changing, top-level navigation in the left-side area. For example, an action that opens a related Customer ViewModel without modifying the current Order is suitable there.

Do not use this area for Save, Cancel, Edit, or an action that creates, deletes, updates, or otherwise changes data. Those actions belong in the horizontal toolbar.

Put nested-object actions in the context menu

An action that applies to a grid row must be available from that object's context menu. This makes the target clear: the user invokes the action while focused on the row it affects.

For example, if an Order ViewModel shows order lines, an action that applies to one order line is accessed from the order-line context menu, not from the root ViewModel's left-side navigation.

ReadOnly analysis is important

The split between non-changing navigation and data-changing actions relies on MDriven's ReadOnly functionality being able to deduce whether an action changes data. Review actions whose behaviour is not obvious, especially actions that navigate after making a change.

For example, an action named Open customer may be left-side navigation if it only opens the customer. If it first updates the order and then opens the customer, it is a data-changing action and belongs in the toolbar.

Roll out safely

  1. Start with Toolbar=true on one representative ViewModel.
  2. Test all root-level actions: navigation, Save, Cancel, and Edit.
  3. Test each grid or nested-object action from its context menu.
  4. Confirm that actions which change data are not presented as safe left-side navigation.
  5. Enable GlobalToolbarMode only after reviewing the affected ViewModels; use Toolbar=false as an opt-out for exceptions.

Client availability

The toolbar mode demonstrated for Turnkey is not available in WPF. Verify the target UI engine during testing if your application uses more than one client.

See also