Symphony Framework
Symphony Style v3 2
Symphony Templates > Symphony Style v3 2
Template file name Symphony_Style_v3_2.tpl

The Symphony_Style (version 3.2) provides the ability to create a powerful repository based set of control styles.  Styles, in WPF, allow you to define and control all aspects of the user interface control including length of input, prompt information, etc.

It is recommended that your generated code from the Symphony_Style template is created into a project sub-folder called Resources.  After generating the code and adding to your Visual Studio project you must modify the Build Action setting to Resource.

This template data-binds to properties that are expected to be Synergy types.  It is deigned for Synergy.Net WPF Application development.  The correct data object template to use with this template is the Symphony_Data_V3_2 template.

This template is associated with the following templates:

 CodeGen Template Tokens
Token Comments
ASSEMBLYNAME Specify the name of the assembly that contains the associated content object references.  Content object reference classes are generated using the Symphony_Content_v3_2 templates.
ANCESTORCONTROL Allows you to define the parent control that contains the data-binding command that will alloow navigation to the visual state to display the lookup list.  This token is only applicable for repository fields that are defined to have a drill method.
 Symphony Tokens

Symphony tokens are applied to fields in the repository in the Long Description.  They allow for additional field processing by CodeGen.  You must define both the token and value, enclosed within <> brackets.  For example <SYMPHONY_MAX_DISPLAY_LENGTH=100>

You can define any number of Symphony tokens in the long description.  There is no separation character required.



Token Comments
SYMPHONY_CONVERTER_PARAMETER A value that will be passed onto the data converter.  See Symphony.Conductor.Converts for more information.
SYMPHONY_SEARCHBOX_COMMAND An alpha field with a drill method assigned will automatically be defined to use the SearchTextBox control. This control allows the user to enter a value or click the spy glass to perform a lookup-type function. The default action is to navigate to a state named as the drill method. You can alter this default behavior by specifying this token. The value should be the data bound command to perform.  See Symphony.Conductor.Commands.GenericCommand for more information.

SYMPHONY_ALPHA_SIZE

For a Synergy Alpha field type you can optionally define the control Width.  This will size the width of the input control to the defined number of points.

SYMPHONY_UPDATE_TRIGGER

This setting allows you to override the default Binding.UpdateSourceTrigger value.

SYMPHONY_ITEMSSOURCE_PATH

Overridew the default items source value for a ComboBox/drop-down control.

SYMPHONY_SELWND_LENGTH

When you assign a selection window to a field this token enables you to define the actual width of the resulting ComboBox/drop-down control.

SYMPHONY_DECIMAL_FORMAT

Allows you to define a format string that will be used when displaying the bound data. By setting the token SYMPHONY_DECIMAL_FORMAT in the long description you can control how field data will be displayed. For example, if you have a D6 field an assigned the format string of ##0.0## you would always see a value in the field, even if it was null or zero. A format string of ###.### will display blank if the property is null or zero.

SYMPHONY_DECIMAL_PLACES

Define the number of decimal places to allow for decimal field types.
 CodeGen Command Examples
Create standard collection
codegen e -r -s PART -t Symphony_Style_v3_2 -o %ROOT%ControlLibrary\Resources -ut ASSEMBLYNAME=ControlLibrary
 Example
<!--
 WARNING: This code was code generated. Any changes that you
          make to this code will be overwritten if the code is regenerated!

 Template author:    Richard C. Morris : RCP Consultants.

 Template Name:    Symphony Framework : SYMPHONY_STYLE_V3_2.tpl

-->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:clr="clr-namespace:System;assembly=mscorlib"
    xmlns:symphonyConverters="clr-namespace:Symphony.Conductor.Converters;assembly=SymphonyConductor"
    xmlns:symphonyTriggers="clr-namespace:Symphony.Conductor.Triggers;assembly=SymphonyConductor"
    xmlns:symphonyUI="clr-namespace:Symphony.Crescendo.Presentation;assembly=SymphonyCrescendo"
    xmlns:symphonyControls="clr-namespace:Symphony.Conductor.Controls;assembly=SymphonyConductor"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/SymphonyConductor;component/Resources/Styles.xaml"/>
        <ResourceDictionary Source="pack://application:,,,/SymphonyConductor;component/Resources/Converters.xaml"/>
        <ResourceDictionary Source="pack://application:,,,/ControlLibrary;component/Resources/Part_Content.CodeGen.xaml"/>
     </ResourceDictionary.MergedDictionaries>


    <clr:String x:Key="Part_Id_heading">Part ID</clr:String>


    <Style x:Key="Part_Id_prompt" TargetType="{x:Type Label}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Label
                        Content="Part ID"
                        IsEnabled="{Binding Path=IdIsEnabled}">
                    </Label>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="Part_Id_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <TextBox
                        Name="ctlPart_Id"
                        Text="{Binding Path=Id, Converter={StaticResource alphaConverter}, UpdateSourceTrigger=PropertyChanged,
                                ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                        MaxLength="20"
                        Width="240"
                        CharacterCasing="Upper"
                        IsEnabled="{Binding Path=IdIsEnabled}"
                        IsReadOnly="{Binding Path=IdIsReadOnly}"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left"
                        ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                                    <i:Interaction.Behaviors>
                                      <symphonyControls:SelectAllTextBoxBehavior></symphonyControls:SelectAllTextBoxBehavior>
                                    </i:Interaction.Behaviors>
                                    <TextBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=IdIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlPart_Id}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                        <Setter Property="TextBox.Background">
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <LinearGradientBrush.GradientStops>
                                                        <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                        <GradientStop Offset="3" Color="Red" />
                                                    </LinearGradientBrush.GradientStops>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBox.Style>
                    </TextBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <clr:String x:Key="Part_Groupid_heading">Group ID</clr:String>


    <Style x:Key="Part_Groupid_prompt" TargetType="{x:Type Label}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Label
                        Content="Group ID"
                        IsEnabled="{Binding Path=GroupidIsEnabled}">
                    </Label>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="Part_Groupid_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <symphonyUI:SearchTextBox
                        HorizontalAlignment="Left"
                        Name="ctlPart_Groupid"
                        Text="{Binding Path=Groupid, Converter={StaticResource alphaConverter}, UpdateSourceTrigger=PropertyChanged,
                                ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                        SearchMode="Delayed"
                        
                        Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=DataContext.NavigateState}"
                        CommandParameter="Drill_Group_IdDrillState"
                        MaxLength="20"
                        Width="240"
                        CharacterCasing="Upper"
                        IsEnabled="{Binding Path=GroupidIsEnabled}"
                        IsReadOnly="{Binding Path=GroupidIsReadOnly}"
                        VerticalAlignment="Center"
                        ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                                    <i:Interaction.Behaviors>
                                      <symphonyControls:SelectAllTextBoxBehavior></symphonyControls:SelectAllTextBoxBehavior>
                                    </i:Interaction.Behaviors>
                        <symphonyUI:SearchTextBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=GroupidIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlPart_Groupid}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                        <Setter Property="TextBox.Background" >
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <LinearGradientBrush.GradientStops>
                                                        <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                        <GradientStop Offset="3" Color="Red" />
                                                    </LinearGradientBrush.GradientStops>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </symphonyUI:SearchTextBox.Style>
                    </symphonyUI:SearchTextBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="Part_Groupid_noDrill_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <TextBox
                        Name="ctlPart_Groupid_noDrill"
                        Text="{Binding Path=Groupid, Converter={StaticResource alphaConverter}, UpdateSourceTrigger=PropertyChanged,
                                ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                        MaxLength="20"
                        Width="240"
                        CharacterCasing="Upper"
                        IsEnabled="{Binding Path=GroupidIsEnabled}"
                        IsReadOnly="{Binding Path=GroupidIsReadOnly}"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left"
                        ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                                    <i:Interaction.Behaviors>
                                      <symphonyControls:SelectAllTextBoxBehavior></symphonyControls:SelectAllTextBoxBehavior>
                                    </i:Interaction.Behaviors>
                                    <TextBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=GroupidIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlPart_Groupid_noDrill}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                        <Setter Property="TextBox.Background" >
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <LinearGradientBrush.GradientStops>
                                                        <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                        <GradientStop Offset="3" Color="Red" />
                                                    </LinearGradientBrush.GradientStops>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBox.Style>
                    </TextBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <clr:String x:Key="Part_Supplierid_heading">Supplier ID</clr:String>


    <Style x:Key="Part_Supplierid_prompt" TargetType="{x:Type Label}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Label
                        Content="Supplier ID"
                        IsEnabled="{Binding Path=SupplieridIsEnabled}">
                    </Label>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="Part_Supplierid_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <symphonyUI:SearchTextBox
                        HorizontalAlignment="Left"
                        Name="ctlPart_Supplierid"
                        Text="{Binding Path=Supplierid, Converter={StaticResource alphaConverter}, UpdateSourceTrigger=PropertyChanged,
                                ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                        SearchMode="Delayed"
                        
                        Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=DataContext.NavigateState}"
                        CommandParameter="Drill_Supplier_IdDrillState"
                        MaxLength="20"
                        Width="240"
                        CharacterCasing="Upper"
                        IsEnabled="{Binding Path=SupplieridIsEnabled}"
                        IsReadOnly="{Binding Path=SupplieridIsReadOnly}"
                        VerticalAlignment="Center"
                        ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                                    <i:Interaction.Behaviors>
                                      <symphonyControls:SelectAllTextBoxBehavior></symphonyControls:SelectAllTextBoxBehavior>
                                    </i:Interaction.Behaviors>
                        <symphonyUI:SearchTextBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=SupplieridIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlPart_Supplierid}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                        <Setter Property="TextBox.Background" >
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <LinearGradientBrush.GradientStops>
                                                        <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                        <GradientStop Offset="3" Color="Red" />
                                                    </LinearGradientBrush.GradientStops>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </symphonyUI:SearchTextBox.Style>
                    </symphonyUI:SearchTextBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="Part_Supplierid_noDrill_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <TextBox
                        Name="ctlPart_Supplierid_noDrill"
                        Text="{Binding Path=Supplierid, Converter={StaticResource alphaConverter}, UpdateSourceTrigger=PropertyChanged,
                                ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                        MaxLength="20"
                        Width="240"
                        CharacterCasing="Upper"
                        IsEnabled="{Binding Path=SupplieridIsEnabled}"
                        IsReadOnly="{Binding Path=SupplieridIsReadOnly}"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left"
                        ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                                    <i:Interaction.Behaviors>
                                      <symphonyControls:SelectAllTextBoxBehavior></symphonyControls:SelectAllTextBoxBehavior>
                                    </i:Interaction.Behaviors>
                                    <TextBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=SupplieridIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlPart_Supplierid_noDrill}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                        <Setter Property="TextBox.Background" >
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <LinearGradientBrush.GradientStops>
                                                        <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                        <GradientStop Offset="3" Color="Red" />
                                                    </LinearGradientBrush.GradientStops>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBox.Style>
                    </TextBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <clr:String x:Key="Part_Description_heading">Description</clr:String>


    <Style x:Key="Part_Description_prompt" TargetType="{x:Type Label}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Label
                        Content="Description"
                        IsEnabled="{Binding Path=DescriptionIsEnabled}">
                    </Label>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="Part_Description_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <TextBox
                        Name="ctlPart_Description"
                        Text="{Binding Path=Description, Converter={StaticResource alphaConverter}, UpdateSourceTrigger=PropertyChanged,
                                ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                        MaxLength="50"
                        Width="600"
                        IsEnabled="{Binding Path=DescriptionIsEnabled}"
                        IsReadOnly="{Binding Path=DescriptionIsReadOnly}"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left"
                        ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                                    <i:Interaction.Behaviors>
                                      <symphonyControls:SelectAllTextBoxBehavior></symphonyControls:SelectAllTextBoxBehavior>
                                    </i:Interaction.Behaviors>
                                    <TextBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=DescriptionIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlPart_Description}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                        <Setter Property="TextBox.Background">
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <LinearGradientBrush.GradientStops>
                                                        <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                        <GradientStop Offset="3" Color="Red" />
                                                    </LinearGradientBrush.GradientStops>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBox.Style>
                    </TextBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <clr:String x:Key="Part_Technical_info_heading">Technical Description</clr:String>


    <Style x:Key="Part_Technical_info_prompt" TargetType="{x:Type Label}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Label
                        Content="Technical Description"
                        IsEnabled="{Binding Path=Technical_infoIsEnabled}">
                    </Label>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="Part_Technical_info_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <TextBox
                        Name="ctlPart_Technical_info"
                        Text="{Binding Path=Technical_info, Converter={StaticResource alphaConverter}, UpdateSourceTrigger=PropertyChanged,
                                ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                        MaxLength="500"
                        Width="600" Height="120" TextWrapping="Wrap"
                        IsEnabled="{Binding Path=Technical_infoIsEnabled}"
                        IsReadOnly="{Binding Path=Technical_infoIsReadOnly}"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left"
                        ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                                    <i:Interaction.Behaviors>
                                      <symphonyControls:SelectAllTextBoxBehavior></symphonyControls:SelectAllTextBoxBehavior>
                                    </i:Interaction.Behaviors>
                                    <TextBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=Technical_infoIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlPart_Technical_info}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                        <Setter Property="TextBox.Background">
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <LinearGradientBrush.GradientStops>
                                                        <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                        <GradientStop Offset="3" Color="Red" />
                                                    </LinearGradientBrush.GradientStops>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBox.Style>
                    </TextBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <clr:String x:Key="Part_Quantity_heading">Quantity</clr:String>


    <Style x:Key="Part_Quantity_prompt" TargetType="{x:Type Label}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Label
                        Content="Quantity"
                        IsEnabled="{Binding Path=QuantityIsEnabled}">
                    </Label>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="Part_Quantity_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <symphonyUI:SynergyIntBox
                        HorizontalAlignment="Left"
                        Name="ctlPart_Quantity"
                        Text="{Binding Path=Quantity, Converter={StaticResource intConverter}, UpdateSourceTrigger=PropertyChanged,
                                ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                        IsEnabled="{Binding Path=QuantityIsEnabled}"
                        MaxLength="4"
                        Width="48"
                        ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                                    <i:Interaction.Behaviors>
                                      <symphonyControls:SelectAllTextBoxBehavior></symphonyControls:SelectAllTextBoxBehavior>
                                    </i:Interaction.Behaviors>
                        <symphonyUI:SynergyIntBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=QuantityIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlPart_Quantity}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                        <Setter Property="TextBox.Background">
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <LinearGradientBrush.GradientStops>
                                                        <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                        <GradientStop Offset="3" Color="Red" />
                                                    </LinearGradientBrush.GradientStops>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </symphonyUI:SynergyIntBox.Style>
                    </symphonyUI:SynergyIntBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <clr:String x:Key="Part_Cost_price_heading">Cost price</clr:String>


    <Style x:Key="Part_Cost_price_prompt" TargetType="{x:Type Label}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Label
                        Content="Cost price"
                        IsEnabled="{Binding Path=Cost_priceIsEnabled}">
                    </Label>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="Part_Cost_price_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <symphonyUI:SynergyDecimalBox
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Name="ctlPart_Cost_price"
                        Text="{Binding Path=Cost_price, Converter={StaticResource impliedDecimalConverter}  ,StringFormat=#0.00
                                , UpdateSourceTrigger=PropertyChanged
                                , ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                        IsEnabled="{Binding Path=Cost_priceIsEnabled}"
                        IsReadOnly="{Binding Path=Cost_priceIsReadOnly}"
                        SynergyDecimalField="True" 
                        
                        NumberOfDecimals="2"
                        MaxLength="12"
                        Width="144"
                        ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                                    <i:Interaction.Behaviors>
                                      <symphonyControls:SelectAllTextBoxBehavior></symphonyControls:SelectAllTextBoxBehavior>
                                    </i:Interaction.Behaviors>
                        <symphonyUI:SynergyDecimalBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=Cost_priceIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlPart_Cost_price}"></Setter>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                        <Setter Property="TextBox.Background">
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                    <LinearGradientBrush.GradientStops>
                                                        <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                        <GradientStop Offset="3" Color="Red" />
                                                    </LinearGradientBrush.GradientStops>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </symphonyUI:SynergyDecimalBox.Style>
                    </symphonyUI:SynergyDecimalBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <clr:String x:Key="Part_Part_status_heading">Status</clr:String>


    <Style x:Key="Part_Part_status_prompt" TargetType="{x:Type Label}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Label
                        Content="Status"
                        IsEnabled="{Binding Path=Part_statusIsEnabled}">
                    </Label>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="Part_Part_status_style" TargetType="{x:Type symphonyControls:FieldControl}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type symphonyControls:FieldControl}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <ComboBox Grid.Row="0"
                            Visibility="{Binding Path=Part_statusIsReadOnly, Converter={StaticResource reverseBooleanToVisibilityConverter}}"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            Name="ctlPart_Part_status"
                            ItemsSource="{Binding Source={StaticResource PART_STATUSitems}}"
                            DisplayMemberPath="Description"
                            SelectedValue="{Binding Path=Part_status, Converter={StaticResource decimalConverter},
                            ValidatesOnDataErrors=True}"
                            Validation.ErrorTemplate="{StaticResource validationTemplate}"
                            SelectedValuePath="IndexValue"
                            IsEnabled="{Binding Path=Part_statusIsEnabled}"
                            Width="96"
                            Margin="0,1,0,1"
                            ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                            <ComboBox.Style>
                                <Style>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=Part_statusIsFocused}" Value="true">
                                            <Setter Property="FocusManager.FocusedElement"
                                                    Value="{Binding ElementName=ctlPart_Part_status}"></Setter>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(Validation.HasError)}" Value="True">
                                            <Setter Property="ComboBox.Background">
                                                <Setter.Value>
                                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                        <LinearGradientBrush.GradientStops>
                                                            <GradientStop Offset="0.2" Color="WhiteSmoke" />
                                                            <GradientStop Offset="3" Color="Red" />
                                                        </LinearGradientBrush.GradientStops>
                                                    </LinearGradientBrush>
                                                </Setter.Value>
                                            </Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </ComboBox.Style>
                        </ComboBox>
                        <TextBox Grid.Row="0"
                                 Width="96"
                                 HorizontalAlignment="Left"
                                 VerticalAlignment="Center"
                                 Margin="0,1,0,1"
                                 Text="{Binding ElementName=ctlPart_Part_status, Path=Text}"
                                 Visibility="{Binding Path=Part_statusIsReadOnly, Converter={StaticResource BooleanToVisibilityConverter}}"
                                 IsReadOnly="True">
                        </TextBox>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>

See Also