Jump to: navigation, search

UBIK Templates


The UI of UBIK® WinX/UWP client is highly customizable. Project engineers/customizers can tailor the UI for minor style changes or major redesigns according to their needs.


General knowledge

Due to the nature of customizing, it's impossible to cover all issues or questions that one might have during customizing. However, the fundamental ones should become self explanatory with the help of the Developer Mode feature. Such questions include and are not limited to:

  • Which parts of the UI are customizable?
  • How do I get the default XAML templates used in the clients?
  • What kind of data can I present in the custom UI?
  • Where should I deploy the custom template files?

UI controls

Controls are basic building blocks for constructing the UI. Several types of them are used in the client.

Standard controls

All standard Universal Windows Platform (UWP) controls can be used for our WinX/UWP client. There are online official documentations available for these controls. Some official or 3rd party apps showcasing these also exist and can be of great help. For example, XAML controls gallery presents a rich collection of examples/tutorials.

3rd party and UBIK controls

We also use a few 3rd party (e.g. Syncfusion) and UBIK® custom made controls in our client. There is currently no compiled lists of such controls. However, as a general rule, any such controls one finds in the default templates can be used in customizings.

Template loading mechanism

Templates with default names

As one can see in the Developer Mode, the default client UI consists of many parts and each of them is defined in an individual template with names such as UBIKChildArea. When a custom template file with the same name is deployed, that template is used by the client instead of the default one that comes with the client.

Templates with custom names

A common problem with customizing templates such as UBIKChildArea is that it alters the UI for all types of child objects. In order to use different templates depending on the objects, solutions such as child area template classification, child item template classification and content area template classification are provided. Custom template files with names such as UBIKChildArea_WorkPackage can be deployed so that only objects of that type display the custom content while the rest still uses the default UI.

Other than the necessary server side data configuration, a template selector is also needed to achieve this. For example, here's the code snippet in the default UBIKContentArea template.

...
<Grid xmlns:tpl="using:UBIK.WinX.Templates">
    <Grid.Resources>
        <tpl:ChildAreaTemplateSelector x:Key="ChildAreaTemplateSelector" />
    </Grid.Resources>
    <ContentControl ContentTemplateSelector="{StaticResource ChildAreaTemplateSelector}" />
</Grid>
...

The child area template selector used in this example determines the child area template to use based on the following rules.

  • If not found and the "Strict Template Loading Policy" setting is turned on, returns an error template; (This can be useful for checking if some templates are missing before the final deployment.)
  • If not found, returns the default UBIKChildArea template.
IC Hint square.pngIt's possible to use a different syntax to refer to a custom named template, e.g.
<ContentControl ContentTemplate="{Binding TemplateService[UBIKChildArea_WorkPackage]}" /> .
However, since the client does not know which default template should be used, an error template will be used if the custom named one can not be found.
IC Hint square.pngIt's also possible to specify a Suffix for the template selector, e.g.
<tpl:ChildAreaTemplateSelector x:Key="ChildAreaTemplateSelector" Suffix="Small" />.
Unlike the custom name template name lookup, the Suffix is no longer considered optional once specified. If such a template file cannot be found, an error template will be used.

Template Selectors

Wiki Under Construction Start.PNG

In general, Template Selectors return DataTemplates based on the given object. UBIK provides template selectors for different Items & Areas and their logic is explained in the following subsections.

ChildItemTemplateSelector (UWP & Xamarin)

This returns a fitting DataTemplate based on the given child item.

UWP

  • If the child item is classified with the child item template classification and carries a valid child item template name:
    • If the given item is a TaskViewModel (namely if the associated object is a Task) and the TaskItemTemplate is not null, it returns that TaskItemTemplate.
    • Otherwise, if the given item is a TaskViewModel (namely if the associated object is a Task) & the TaskItemTemplate is null, it returns a UBIKTaskItem template.
    • If the given MROViewModel contains ProjectData (namely if the associated object is a MRO object with project information) and the ProjectItemTemplate is not null, it returns that ProjectItemTemplate.
    • Otherwise, if the given MROViewModel contains ProjectData (namely if the associated object is a MRO object with project information) and the ProjectItemTemplate is null, it returns a UBIKProjectItem template.
    • If nothing of the above fits & the ChildItemTemplate is not null, it returns that ChildItemTemplate.
    • If nothing of the above fits & the ChildItemTemplate is null, it returns a UBIKChildItem template.

Xamarin

  • If the child item is classified with the child item template classification and carries a valid child item template name:
    • If the given item is a TaskViewModel (namely if the associated object is a Task) and the TaskItemTemplate is not null, it returns that TaskItemTemplate.
    • Otherwise, if the given item is a TaskViewModel (namely if the associated object is a Task) & the TaskItemTemplate is null, it returns a UBIKTaskItem template.
    • If the given MROViewModel contains ProjectData (namely if the associated object is a MRO object with project information) and the ProjectItemTemplate is not null, it returns that ProjectItemTemplate.
    • Otherwise, if the given MROViewModel contains ProjectData (namely if the associated object is a MRO object with project information) and the ProjectItemTemplate is null, it returns a UBIKProjectItem template.
    • If nothing of the above fits & the ChildItemTemplate is not null, it returns that ChildItemTemplate.
    • If nothing of the above fits & the ChildItemTemplate is null, it returns a UBIKChildItem template.
  • Returns null if the given item is null.
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.

PropertyDirectItemTemplateSelector (UWP & Xamarin)

This returns a fitting DataTemplate based on the given property item.

UWP

  • Returns a non-direct edit template (namely UBIKPropertyDirectItemNotSupported):
    • when the given PropertyViewModel is a live value item or
    • if the related property is read only or
    • if the object is locked or
    • when the property requires authentication.
  • Otherwise:
    • Returns a UBIKPropertyDirectItemList template if the MetaProperty of the given item has a SelectiveList.
    • Returns a UBIKPropertyDirectItemBool template if the given Property is of type Bool.
    • Returns a UBIKPropertyDirectItemString template if the given Property is of type String.
    • Returns a UBIKPropertyDirectItemInt template if the given Property is of type Int.
    • Returns a UBIKPropertyDirectItemDouble template if the given Property is of type Double.
    • Returns a UBIKPropertyDirectItemDateTime template if the given Property is of type DateTime.
    • Returns a UBIKPropertyDirectItemGuid template if the given Property is of type Guid.
    • Returns a UBIKPropertyDirectItemGeoData template if the given Property is of type GeoData.

Xamarin

  • Returns a non-direct edit template (namely UBIKPropertyItem):
    • when the given PropertyViewModel is a live value item or
    • if the related property is read only or
    • if the object is locked or
    • when the property requires authentication or
    • if the given TaskViewModels (namely the associated object is a Task) Value is of type GeoData or DateTime.
  • Otherwise:
    • Returns a UBIKPropertyDirectItemList template if the MetaProperty of the given item has a SelectiveList.
    • Returns a UBIKPropertyDirectItemBool template if the given Property is of type Bool.
    • Returns a UBIKPropertyDirectItemString template if the given Property is of type String.
    • Returns a UBIKPropertyDirectItemInt template if the given Property is of type Int.
    • Returns a UBIKPropertyDirectItemDouble template if the given Property is of type Double.
    • Returns a UBIKPropertyDirectItemGuid template if the given Property is of type Guid.
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.

TaskPropertyTemplateSelector (UWP & Xamarin)

This returns a fitting DataTemplate based on the given task property item.

UWP

  • Returns a non-direct edit template (UBIKTaskProperty):
    • when the PropertyViewModel of the given TaskViewModel (namely if the associated object is a Task) is a live value item or
    • if the related property is read only or
    • if the object is locked or
    • when the property requires authentication.
  • Otherwise:
    • Returns a UBIKTaskPropertyList template if the MetaProperty of the given item has a SelectiveList.
    • Returns a UBIKTaskPropertyBool template if the given TaskViewModels (namely the associated object is a Task) Value is of type Bool.
    • Returns a UBIKTaskPropertyString template if the given TaskViewModels (namely the associated object is a Task) Value is of type String.
    • Returns a UBIKTaskPropertyInt template if the given TaskViewModels (namely the associated object is a Task) Value is of type Int.
    • Returns a UBIKTaskPropertyDouble template if the given TaskViewModels (namely the associated object is a Task) Value is of type Double.
    • Returns a UBIKTaskPropertyDateTime template if the given TaskViewModels (namely the associated object is a Task) Value is of type DateTime.
    • Returns a UBIKTaskPropertyGuid template if the given TaskViewModels (namely the associated object is a Task) Value is of type Guid.
    • Returns a UBIKTaskPropertyGeoData template if the given TaskViewModels (namely the associated object is a Task) Value is of type GeoData.

Xamarin

  • Returns a non-direct edit template (UBIKTaskProperty):
    • when the PropertyViewModel of the given TaskViewModel (namely if the associated object is a Task) is a live value item or
    • if the related property is read only or
    • if the object is locked or
    • when the property requires authentication or
    • if the given TaskViewModels (namely the associated object is a Task) Value is of type GeoData or DateTime.
  • Otherwise:
    • Returns a UBIKTaskPropertyList template if the MetaProperty of the given item has a SelectiveList.
    • Returns a UBIKTaskPropertyBool template if the given TaskViewModels (namely the associated object is a Task) Value is of type Bool.
    • Returns a UBIKTaskPropertyString template if the given TaskViewModels (namely the associated object is a Task) Value is of type String.
    • Returns a UBIKTaskPropertyInt template if the given TaskViewModels (namely the associated object is a Task) Value is of type Int.
    • Returns a UBIKTaskPropertyDouble template if the given TaskViewModels (namely the associated object is a Task) Value is of type Double.
    • Returns a UBIKTaskPropertyGuid template if the given TaskViewModels (namely the associated object is a Task) Value is of type Guid.
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.

HotSpotTemplateSelector (UWP & Xamarin)

This returns a fitting DataTemplate based on the given HotSpot item.

  • Returns a UBIKAngularLinkHotSpot template if the given HotSpot is of type LinkHotSpot with HotSpotShape Angular & if the UBIKAngularLinkHotSpot template is not null.
  • Returns a UBIKRoundLinkHotSpot template if the given HotSpot is of type LinkHotSpot with HotSpotShape Round & if the UBIKRoundLinkHotSpot template is not null.
  • Returns a UBIKSignatureHotSpot template if the given HotSpot is of type SignatureSpot & if the UBIKSignatureHotSpot template is not null.
  • Returns a UBIKObjectHotSpot template if the given HotSpot is of type ObjectHotSpot & if the UBIKObjectHotSpot template is not null.
  • Returns a UBIKMediaHotSpot template if the given HotSpot is of type MediaSpot & if the UBIKMediaHotSpot template is not null.
  • Returns a UBIKInputHotSpot template if the given HotSpot is of type InputHotSpot & if the UBIKInputHotSpot template is not null.
  • If nothing of the above fits, it returns a UBIKDefaultHotSpot template.
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.


ProfileItemTemplateSelector (UWP)

  • This returns a UBIKProfileItem template if the given item is a Profile file.
  • If the given item is a folder, it returns a UBIKProfileFolder template.
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.


RootItemTemplateSelector (UWP)

This returns a fitting DataTemplate based on the given root item.

  • It returns a UBIKProjectItem template if the given item is a MROViewModel and contains ProjectData (namely if the associated object is a MRO object with project information).
  • It returns a UBIKTaskItem template if the given item is a TaskViewModel (namely if the associated object is a Task).
  • If nothing of the above fits, it returns a UBIKMainItem.
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.


ComboBoxItemTemplateSelector (UWP)

  • This returns a DropDownItemTemplate for drop-down list items.
  • Otherwise, it returns a ComboBoxSectionItemTemplate (for the selected item when the drop-down list is closed).
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.


ChildAreaTemplateSelector (UWP) / ChildAreaTemplateConverter (Xamarin)

This returns a fitting template for a given context object according to the following rules:

UWP

  • If the context object is classified with the ChildAreaTemplate Classification and carries a valid child area template name:
    • Tries to return a custom template with the name of CustomTemplateName + Suffix;
    • If not found, returns an error template (strict policy on) or goes to the next rule (strict policy off).
  • Otherwise:
    • Tries to return a custom template with the name UBIKChildArea + Suffix;
    • If not found, it will try to find the default template with the given name;
    • If that's not found, it returns an error template.

Xamarin

  • If the context object is classified with the ChildAreaTemplate Classification and carries a valid child area template name:
    • Tries to return a custom template with the name of CustomTemplateName;
    • If that's not found, it returns an error template.
  • Otherwise:
    • Tries to return a custom template with the name UBIKChildArea;
    • If not found, it will try to find the default template with the given name;
    • If that's not found, it returns an error template.
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.


ContentAreaTemplateSelector (UWP) / ContentAreaTemplateConverter (Xamarin)

This returns a fitting template for a given context object according to the following rules:

UWP

  • If the context object is classified with the ContentAreaTemplate Classification and carries a valid content area template name:
    • Tries to return a custom template with the name of CustomTemplateName + Suffix;
    • If not found, returns an error template (strict policy on) or goes to rule 2 (strict policy off).
  • Otherwise:
    • Tries to return a custom template with the name of UBIKContentArea + Suffix;
    • If not found, it returns an error template.

Xamarin

  • If the context object is classified with the ContentAreaTemplate Classification and carries a valid content area template name:
    • Tries to return a custom template with the name of CustomTemplateName;
    • If not found, returns an error template.
  • Otherwise:
    • Tries to return a custom template with the name of UBIKContentArea;
    • If not found, it returns an error template.
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.


PropertyEditorItemTemplateSelector (UWP) / EditTemplateConverter (Xamarin)

This returns a fitting template for a given context property according to the following rules:

UWP

  • Returns a UBIKEditBool template if the given Property is of type Bool.
  • Returns a UBIKEditString template if the given Property is of type String.
  • Returns a UBIKEditInt template if the given Property is of type Int.
  • Returns a UBIKEditDouble template if the given Property is of type Double.
  • Returns a UBIKEditDateTime template if the given Property is of type DateTime.
  • Returns a UBIKEditGuid template if the given Property is of type Guid.
  • Returns a UBIKEditSignature template if the given Property is of type Signature.
  • Returns a UBIKEditChart template if the given Property is of type Chart.
IC Hint square.pngEven though UBIK has an editor for GeoData and FileReference type, its UI is not customizable and therefore the selector is not relevant for them.
IC Hint square.pngUBIK doesn't show editors for XML, ByteStream, Geography, and Undefined type, therefore the selector is not relevant for them.

Xamarin

  • Returns a UBIKEditBool template if the given Property is of type Bool.
  • Returns a UBIKEditString template if the given Property is of type String.
  • Returns a UBIKEditInt template if the given Property is of type Int.
  • Returns a UBIKEditDouble template if the given Property is of type Double.
  • Returns a UBIKEditDateTime template if the given Property is of type DateTime.
  • Returns a UBIKEditGuid template if the given Property is of type Guid.
  • Returns a UBIKEditGeo template if the given Property is of type GeoData.
  • Returns a UBIKEditSignature template if the given Property is of type Signature.
  • Returns an error template if the given Property is of type XML, ByteStream, Geography, FileReference, or Undefined.
IC Hint square.pngTo get an overview of how template selectors work, please refer to Template loading mechanism.

Wiki Under Construction End.PNG