From 6cbe9f9d2a604cdbb74f46f3710ea3dc60a87e55 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Sun, 27 Aug 2017 06:51:36 +0200 Subject: first step in implementing a dispose mechanism for graphic objects --- src/GraphicObjects/TemplatedControl.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/GraphicObjects/TemplatedControl.cs') diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index b0d752ed..ba580dae 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -48,6 +48,9 @@ namespace Crow string _template; string caption; + /// + /// Template path + /// [XmlAttributeAttribute][DefaultValue(null)] public string Template { get { return _template; } @@ -99,6 +102,9 @@ namespace Crow protected virtual void loadTemplate(GraphicObject template = null) { + if (this.child != null)//template change, bindings has to be reset + this.ClearTemplateBinding(); + if (template == null) { if (!Interface.DefaultTemplates.ContainsKey (this.GetType ().FullName)) throw new Exception (string.Format ("No default template found for '{0}'", this.GetType ().FullName)); -- cgit v1.3.1-4-g156e