diff options
Diffstat (limited to 'src/GraphicObjects/TemplatedControl.cs')
| -rw-r--r-- | src/GraphicObjects/TemplatedControl.cs | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index dd7c742d..75176c34 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -71,38 +71,47 @@ namespace Crow string _template; - [XmlAttributeAttribute][DefaultValue("#Crow.Templates.Template.goml")] + [XmlAttributeAttribute][DefaultValue(null)] public string Template { get { return _template; } - set { _template = value; } - } + set { + if (Template == value) + return; + _template = value; - #region GraphicObject overrides - [XmlAttributeAttribute()][DefaultValue(-1)] - public override int Width { - get { return base.Width; } - set { - base.Width = value; - //PropertyLess binding for sizing policy in template - if (base.Width < 1) //send size policy to template elements - NotifyValueChanged ("TemplatedWidth", base.Width); - else //stretched in control if size is fixed - NotifyValueChanged ("TemplatedWidth", 0); + if (string.IsNullOrEmpty(_template)) + loadTemplate (); + else + loadTemplate (Interface.Load (_template, this)); } } - [XmlAttributeAttribute()][DefaultValue(-1)] - public override int Height { - get { return base.Height; } - set { - base.Height = value; - //PropertyLess binding for sizing policy in template - if (base.Height < 1) //send size policy to template elements - NotifyValueChanged ("TemplatedHeight", base.Height); - else //stretched in control if size is fixed - NotifyValueChanged ("TemplatedHeight", 0); - } - } + #region GraphicObject overrides +// [XmlAttributeAttribute()][DefaultValue(-1)] +// public override int Width { +// get { return base.Width; } +// set { +// base.Width = value; +// //PropertyLess binding for sizing policy in template +// if (base.Width < 1) //send size policy to template elements +// NotifyValueChanged ("TemplatedWidth", base.Width); +// else //stretched in control if size is fixed +// NotifyValueChanged ("TemplatedWidth", 0); +// } +// } +// [XmlAttributeAttribute()][DefaultValue(-1)] +// public override int Height { +// get { return base.Height; } +// set { +// base.Height = value; +// +// //PropertyLess binding for sizing policy in template +// if (base.Height < 1) //send size policy to template elements +// NotifyValueChanged ("TemplatedHeight", base.Height); +// else //stretched in control if size is fixed +// NotifyValueChanged ("TemplatedHeight", 0); +// } +// } public override GraphicObject FindByName (string nameToFind) { //prevent name searching in template |