Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

TemplateContext Struct

Represents a Template context.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v21.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public struct TemplateContext :
    IEquatable<TemplateContext>

Remarks

To represent Views in a UI, XAF uses Windows and Frames. These are abstract entities visualized in the UI via Templates - controls implementing the IWindowTemplate and IFrameTemplate interfaces. Templates define what a Window or a Frame will look like, what Action Containers will be present and where the View site will be located. XAF has a number of built-in templates which are used in different situations. For instance, there is a Template used to display the main Window and a Template used to display a pop-up Window. For a description of built-in templates, refer to the Templates help topic.

When a Frame or a Window needs to be instantiated, XAF must determine what Template should be used. Template contexts solve this task. They are used as parameter values by the XafApplication.CreateFrame and XafApplication.CreateWindow methods. A Template context is an instance of the TemplateContext structure. Instances differ only by their names exposed via the TemplateContext.Name property. All the possible contexts are predefined, and are accessible via static properties of the TemplateContext structure. For example, there is the nested frame context defined by the TemplateContext.NestedFrame property. When a Frame is instantiated in such a context, XAF will use NestedFrameTemplateV2 as the Frame’s control. Another example is the undefined context defined by the TemplateContext.Undefined field. When this context is used, XAF will try to use the most appropriate Template in a given situation.

Generally, you do not need to operate contexts, because Frames and Windows are instantiated automatically. However, you can customize existing Templates and create new ones. To learn how to do this, refer to the Template Customization help topic. This topic also contains a table, listing the Templates associated with particular contexts.

See Also