Master View Template – Set a Default for All Your Views

A Master View Template enables you to predefine view properties for all your views in one file. All view templates will inherit the properties defined in the Master View Template. This allows you for example to define the appearance of properties in the Properties Pad. By changing the settings in particular views the master settings can be overwritten. Thus, the master can be seen as a way to define default values.

How to create a Master View Template

To create a Master View Template, add a new file to the ViewTemplates folder in the Solution Explorer via the New File Dialog (right click on the ViewTemplates folder–> Add –> New File –> MasterViewTemplate).

Then, open the file (MasterViewTemplate.slvt) and customize it as needed. If you have never worked with XML View Templates before make sure to read this article. In the Master View Template, you should not set a VisualTarget for any of the Style definitions. Have a look at the code example below for possible properties and the View Template structure.

<Style DataSource=".BomNode">
<Property Name="id" DisplayName="ID (unique Number)" IsReadOnly="false" IsHidden="false"     />

In this example, the display name for the property id of the node class BomNode is set to show up as ID (unique Number). Find a list of all customizable properties here. When working with a Master View Template Keep in mind a few things:

  • The tool looks for the name MasterViewTemplate.slvt so make sure not to change the name!
  • The definitions made in the Master View Template will affect all views.
  • You should only use one Master View Template per project.
  • Whenever you redefine a setting in a view template it will overwrite the master setting for this particular view.
  • Using default view templates in the Open View Dialog may overwrite master settings. For example, if you create a new Graph view with the Open View Dialog using the default view template will overwrite node shape and color settings or edge dash and color settings.

Was this article helpful?

Related Articles