diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-17 08:44:34 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-17 08:44:34 +0100 |
| commit | a8156b149f2e4a3c087bcb090db293d08116bd67 (patch) | |
| tree | 51dd4165422863f70c656de8e0bbfa7c079142bb /src/GraphicObjects/TemplatedControl.cs | |
| parent | 3c1dbdbbc58d38d45276e3147c3717d19a69adf2 (diff) | |
| parent | bf27b88a6cbfcc65d7ed6360f9193d52f96b1598 (diff) | |
Merge branch 'DefTemplateSizing0'
Diffstat (limited to 'src/GraphicObjects/TemplatedControl.cs')
| -rw-r--r-- | src/GraphicObjects/TemplatedControl.cs | 71 |
1 files changed, 45 insertions, 26 deletions
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index 50199f7a..75176c34 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -38,6 +38,16 @@ namespace Crow } } [AttributeUsage(AttributeTargets.Class)] + public class StyleAttribute : Attribute + { + public string PropertyName = ""; + public object DefaultValue = null; + public StyleAttribute(string _property, object _defValue){ + PropertyName = _property; + DefaultValue = _defValue; + } + } + [AttributeUsage(AttributeTargets.Class)] public class DefaultTemplate : TemplateAttribute { public DefaultTemplate(string path) : base(path){} @@ -61,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 |