Keep up to date with the Symphony Framework by subscribing to the mailing list.

Check out the new Symphony Framework Academy! It’s the home for information and tutorials to help you get the most from the Symphony Framework! Click on the Academy option below.

Symphony Framework Development

Symphony Framework Synergy Date Field Overview.


A Synergy date field stores numeric data representing a date value. The amount of storage available is determined by its size. A Synergy date field is designed to store a whole number that represents an actual date value, or zero.

You should define a prompt value for your Date fields. Prompts are used in the UI to define field labels and report headings (you can also define a report heading, see below). Do not include special characters like > and <. If you need these in the prompt you must escape the character. The following table shows the escaped values:
Character Syntax Description


Using the Synergy Repository, Symphony Framework templates, and CodeGen you can build powerful user interface styles, user controls and windows. All field entry controls utilise styles. A style defines how the user control will be rendered on the user interface. They also provide the ability to enable and display field/prompt entities, provide error state information and control input focus.

When you utilise the Synergy Repository and the CodeGen utility with the Symphony Framework templates to generate the styles for your user interface controls the templates utilise the fields and attributes defined in your repository. When processing a field there are a number of styles produced. The different styles allow you to accommodate a number of different scenarios in your Windows Presentation Foundation applications.

Date fields are exposed as a standard DatePicker control. This control allows entry of valid date values and the user can use the pop-out calendar control to select the required date.

Attribute Comment
Size Will determine the typeof date field being defined. The standard reccomended size is 8 bytes.
Exclude by Language Prevents the field being exposed through the Symphony Data Object. This is useful for hiding large/complex array and group elements. If you want the field available, but not exposed as a property then you should define the field with the token in the long description. See the long description tokens section below
Exclude by Toolkit Prevents the field from being included in any view or DataGrid. No style is created for the field. It will still be available as a property in the Data Object.
Exclude by Report Writer Will exclude the field from any criteria selection windows. This prevents the user from being able to see/use this field to select records in the data source. Fields will also not be available for inclusion by the user within DataGrid views. It will still be available as a property in the Data Object.
Prompt Used to propagate the field's associated Label style. As per the rules defined by CodeGen, if this attribute is not defined the field name will be used.
Report Heading Will populate the DataGrid column heading is specified. As per the rules defined by CodeGen, if this attribute is not defined the field prompt will be used.
Date (Today) Will force the date value to default to todays date if the date is zero. If this attribute is not set then the DatePicker control will display Select
Break Forces the entered data to update the data bound property as the data is changed, not when the field has lost focus. Note: Due to a current limitation in the Microsoft Framework 4.0 this setting is currently ignored and ALL fields are defined to update bound data when the property changes.
Required The field will be in error until at least one character is entered.
Hyperlink Method Will display the fields associated label as a HyperLinkLabel that can be clicked by the user, and a new visual state presented.

Long Description tokens


There are a number of tokens that can be defined in the long description for a field that will alter the code generated. the following table lists all possible tokens and their associated actions. All tokens are defined within < and > characters.

Token Action
SYMPHONY_ARRAY_FIELD This token identifys the field as an arrayed field which is to be excluded from the property list of the Data Object. When CodeGen encounteres an arrayed field it flattens the field and creates individual properties/fields for each element. This can cuase the creation of large Data Objects. Arrayed fields are very cumbersome to manage also. By setting this custom token you can prevent these arrayed field form being included as properties in Data Objects and from many other Symphony tempaltes.

Examples


When you code genernate a style (using the Symphony_Style.tpl template) the generated XAML code defines the date field style based on the field attributes in the repository.

In this example we have defined a standard date field stored as a reversed decimal 8 byte. The code generated style defines the standard DatePicker styling based on the attributes defined against the field.

<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: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.MergedDictionaries>

    <Style x:Key="Custom_Cdolc_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}">
                    <DatePicker
                        HorizontalAlignment="Left"
                        Name="ctlCustom_Cdolc"
                        SelectedDate="{Binding Path=Cdolc, Converter={StaticResource decimalDateConverter}, UpdateSourceTrigger=PropertyChanged,
                                ConverterParameter=FORMAT:YYYYMMDD|NODEFAULTODAY,
                                ValidatesOnDataErrors=True}"
                                Validation.ErrorTemplate="{StaticResource validationTemplate}"
                                IsEnabled="{Binding Path=CdolcIsEnabled}"
                                VerticalAlignment="Center"
                                ToolTip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors), Converter={StaticResource errorConveter}}">
                        <DatePicker.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=CdolcIsFocused}" Value="true">
                                        <Setter Property="FocusManager.FocusedElement"
                                                Value="{Binding ElementName=ctlCustom_Cdolc}"></Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </DatePicker.Style>
                    </DatePicker>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>


Becuase the standard DatePicker control does not support "read-only" the Symphony template defines a read-only style that you can use when you want to display a data bound read-only date value for a field. Define the field in the Repository as read-only.

<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: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.MergedDictionaries>

    <Style x:Key="Custom_Cdolc_RO_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
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left"
                        IsReadOnly="True"
                        Text="{Binding Path=Cdolc, Converter={StaticResource decimalDateConverter},
                        ConverterParameter=FORMAT:YYYYMMDD|NODEFAULTODAY
                        , StringFormat=\{0:d\}}"
                        Width="128">
                        </TextBox>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
     </Style>

</ResourceDictionary>