ComponentOne Query 8.0
Modifying Templates at Run Time

Most aspects of C1QueryFrame display presentation are controlled by templates, see Customizing the UI with Templates. Although normally all template attributes that need customization are defined at design time in a template file, sometimes it can be necessary to change templates at run time.

Calling the LoadTemplatesFromFile method, the whole set of customized template attributes can be replaced with new templates from a file.

The SetTemplateAttribute method allows you to change a single template attribute without affecting others.

Finally, it is possible to parameterize template attributes, to use a special tag, C1Q_USERDATA, a placeholder that is substituted for a real value at run time. This is necessary in cases where some information, such as file locations, and so on, is unavailable at design time. Setting the TemplateUserData indexed property, you can specify the values that must be substituted in templates instead of the C1Q_USERDATA tag. Templates with C1Q_USERDATA will usually not work properly at design time. Although it does not cause real problems (it only results in a garbled display on your control at design time), you can set the DesignTimeTemplates property to False to prevent this from happening.

Calling the SetTemplateAttribute and setting the TemplateUserData property, call the Render method if you need the changes to take effect immediately. Otherwise, they will take effect when the query contents will be rendered for display.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback