From 71a43a4a86547c1959eb546bf48aeb1f5572df45 Mon Sep 17 00:00:00 2001 From: James Westman Date: Mon, 8 Jan 2024 19:28:14 -0600 Subject: [PATCH] docs: Add section on referencing templates --- docs/reference/templates.rst | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/reference/templates.rst b/docs/reference/templates.rst index 180979f..a1a9968 100644 --- a/docs/reference/templates.rst +++ b/docs/reference/templates.rst @@ -66,14 +66,27 @@ This ``MapsHeaderBar`` class, along with its blueprint template, can then be ref } } -ID & Parent Parameters -~~~~~~~~~~~~~~~~~~~~~~ +Type & Parent Parameters +~~~~~~~~~~~~~~~~~~~~~~~~ The type name that directly follows the ``template`` keyword is the type of the template class. In most cases, this will be an extern type starting with ``$`` and matching the class name in the application code. Templates for use in a `Gtk.BuilderListItemFactory `_ use ``ListItem`` as the type name instead. The parent type is optional, and may only be present if the template type is extern. It enables limited type checking for the properties and signals of the template object. +Referencing a Template +---------------------- + +To reference the template object in a binding or expression, use the ``template`` keyword: + +.. code-block:: blueprint + + template $MyTemplate { + prop1: "Hello, world!"; + prop2: bind template.prop1; + } + + Language Implementations ------------------------