diff --git a/apps/tests/xml-declaration/template-builder-tests/simple-template-test.xml b/apps/tests/xml-declaration/template-builder-tests/simple-template-test.xml
new file mode 100644
index 000000000..796b5bef5
--- /dev/null
+++ b/apps/tests/xml-declaration/template-builder-tests/simple-template-test.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
diff --git a/apps/tests/xml-declaration/template-builder-tests/template-view.ts b/apps/tests/xml-declaration/template-builder-tests/template-view.ts
new file mode 100644
index 000000000..43fcf1d89
--- /dev/null
+++ b/apps/tests/xml-declaration/template-builder-tests/template-view.ts
@@ -0,0 +1,33 @@
+import { View, Template } from "ui/core/view"
+import { PropertyChangeData, Property, PropertyMetadataSettings } from "ui/core/dependency-observable"
+import * as proxy from "ui/core/proxy"
+import { LayoutBase } from "ui/layouts/layout-base"
+import { parse } from "ui/builder"
+
+export module knownTemplates {
+ export var template = "template";
+}
+
+export class TemplateView extends LayoutBase {
+ public static templateProperty = new Property(
+ "template",
+ "TemplateView",
+ new proxy.PropertyMetadata(
+ undefined,
+ PropertyMetadataSettings.AffectsLayout,
+ null
+ )
+ );
+
+ get template(): string | Template {
+ return this._getValue(TemplateView.templateProperty);
+ }
+
+ set template(value: string | Template) {
+ this._setValue(TemplateView.templateProperty, value);
+ }
+
+ public parseTemplate() {
+ this.addChild(parse(this.template));
+ }
+}
diff --git a/apps/tests/xml-declaration/xml-declaration-tests.ts b/apps/tests/xml-declaration/xml-declaration-tests.ts
index 5a1a3890b..5a39c9116 100644
--- a/apps/tests/xml-declaration/xml-declaration-tests.ts
+++ b/apps/tests/xml-declaration/xml-declaration-tests.ts
@@ -14,6 +14,8 @@ import stackLayoutModule = require("ui/layouts/stack-layout");
import {Label} from "ui/label";
import {Page} from "ui/page";
import {Button} from "ui/button";
+import {View} from "ui/core/view";
+import {TemplateView} from "./template-builder-tests/template-view";
import myCustomControlWithoutXml = require("./mymodule/MyControl");
import listViewModule = require("ui/list-view");
import helper = require("../ui/helper");
@@ -818,4 +820,19 @@ export function test_searchbar_donotcrash_whentext_isspace() {
var sb = p.content;
TKUnit.assertEqual(sb.text, " ");
-};
\ No newline at end of file
+};
+
+export function test_parse_template_property() {
+ var page = builder.load(fs.path.join(__dirname, "template-builder-tests/simple-template-test.xml"));
+ TKUnit.assert(page, "Expected root page.");
+ var templateView = page.getViewById("template-view");
+ TKUnit.assert(templateView, "Expected TemplateView.");
+ TKUnit.assert(templateView.template, "Expected the template of the TemplateView to be defined");
+
+ TKUnit.assertEqual(templateView.getChildrenCount(), 0, "Expected TemplateView initially to have no children.");
+ templateView.parseTemplate();
+ TKUnit.assertEqual(templateView.getChildrenCount(), 1, "Expected TemplateView initially to have 1 child.");
+ var button =