Customize the Data Standard Template Path in Vault

By default, the New Data Standard function looks in the $\Templates folder in Vault for document templates. This path can be modified in the Data Standard XAML file. Administrators also have the option of specifying separate template folders for different applications (e.g., one for AutoCAD templates and another for Inventor templates).

How It Works

The default New File dialog for Data Standard contains a combo box called Document Type.

When a user selects an option from the Document type list and clicks OK, the New Data Standard File function looks for a template in the Vault folder path associated with that document type. The template is used to generate the new file.

Configure the Template Path for the New Standard File Dialog

Specify a different template path in Vault by modifying the following section of the Data Standard XAML file.

<?xml version="1.0" encoding="utf-8"?>
<WPF:MainWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="MainWindow" xmlns:WPF="clr-namespace:CreateObject.WPF;assembly=CreateObject" AllowsTransparency="False" Background="#F0F0F0" MinWidth="500" MinHeight="518" MaxHeight="518">
    <Window.Resources>
        <!------------------------------------------------------------------------------------------------->
        <!-- This XmlDataProvider is used for defining Name/TemplatePath pairs that are used in the combo box "Document Type" and can be easily extended -->
        <XmlDataProvider x:Key="DocTypes"
                         XPath="/DocTypeData">                        
            <x:XData>
                <DocTypeData xmlns="">
                    <DocTypeInfo>
                        <Name>Inventor Part</Name>
                        <TemplatePath>$\Templates\Inventor\IPT</TemplatePath>
                    </DocTypeInfo>
                    <DocTypeInfo>
                        <Name>Inventor Assembly</Name>
                        <TemplatePath>$\Templates\Inventor\IAM</TemplatePath>
                    </DocTypeInfo>
                    <DocTypeInfo>
                        <Name>Inventor Drawings</Name>
                        <TemplatePath>$\Templates\Inventor\IDW</TemplatePath>
                    </DocTypeInfo>
                    <DocTypeInfo>
                        <Name>AutoCAD Drawings</Name>
                        <TemplatePath>$\Templates\AutoCAD</TemplatePath>
                    </DocTypeInfo>
                </DocTypeData>
            </x:XData>
        </XmlDataProvider>
        <!------------------------------------------------------------------------------------------------->
        ...

The element <Name> defines the value that is displayed in the combo box on the New File dialog. The element <TemplatePath> is invisible to the user, but is used to set the "TemplatePath" inside the View Model.

The combo box "Document Type" looks like this:

...
<Label Content="Document Type" Grid.Row="2" Grid.Column="0" />
<ComboBox ItemsSource="{Binding Source={StaticResource DocTypes}, XPath=DocTypeInfo}"
          Name="DocTypeCombo"
          Grid.Row="2"
          Grid.Column="1"
          IsEnabled="{Binding IsNewEntryDialog}"
          DisplayMemberPath="Name"
          SelectedValuePath="TemplatePath"
          SelectedValue="{Binding TemplatePath}"
          SelectedIndex="0"></ComboBox>
...

The attribute DisplayMemberPath defines which element from the data source is used for display in the combo box. In this instance, it is set to "Name."

The attribute SelectedValuePath defines which element from the data source ("TemplatePath") is set as the template path value to use.

The attribute SelectedValue="{Binding TemplatePath}" sets the selected template path in the View Model. The new binding property "TemplatePath" has to be added to the View Model.