summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/TemplateUtilities.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Core/TemplateUtilities.cs')
-rw-r--r--Xamarin.Forms.Core/TemplateUtilities.cs16
1 files changed, 11 insertions, 5 deletions
diff --git a/Xamarin.Forms.Core/TemplateUtilities.cs b/Xamarin.Forms.Core/TemplateUtilities.cs
index 0599e747..a965308c 100644
--- a/Xamarin.Forms.Core/TemplateUtilities.cs
+++ b/Xamarin.Forms.Core/TemplateUtilities.cs
@@ -110,14 +110,20 @@ namespace Xamarin.Forms
}
ControlTemplate template = self.ControlTemplate;
- var content = template.CreateContent() as View;
-
- if (content == null)
+ if (template == null)
{
- throw new NotSupportedException("ControlTemplate must return a type derived from View.");
+ // do nothing for now
}
+ else
+ {
+ var content = template.CreateContent() as View;
+ if (content == null)
+ {
+ throw new NotSupportedException("ControlTemplate must return a type derived from View.");
+ }
- self.InternalChildren.Add(content);
+ self.InternalChildren.Add(content);
+ }
}
}
} \ No newline at end of file