aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GraphicObject.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-25 11:35:03 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-25 11:35:03 +0100
commitdd6682973fa16921b7ebaf5faa416290c3211c63 (patch)
tree5c6b3d098165a9c5da0e5a7a8944423bcaa90294 /src/GraphicObjects/GraphicObject.cs
parent42fcd3657d6425005ed7f429fe9b73cfb6fcf1c6 (diff)
replace StyleAttribute=>DefaultStyle
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
-rw-r--r--src/GraphicObjects/GraphicObject.cs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 23748b3a..e8453937 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -438,7 +438,7 @@ namespace Crow
(LogicalParent as GraphicObject).DataSource : dataSource;
}
}
- [XmlAttributeAttribute][DefaultValue(null)]
+ [XmlAttributeAttribute]
public virtual string Style {
get { return style; }
set {
@@ -484,8 +484,6 @@ namespace Crow
il.Emit(OpCodes.Nop);
- StyleAttribute[] style = thisType.GetCustomAttributes().OfType<StyleAttribute>().ToArray();
-
foreach (PropertyInfo pi in thisType.GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
string name = "";
object defaultValue = null;
@@ -504,16 +502,17 @@ namespace Crow
else
name = xaa.AttributeName;
}
-
- StyleAttribute piStyle = style.Where(s => s.PropertyName == pi.Name).FirstOrDefault();
- if (piStyle != null){
- defaultValue = piStyle.DefaultValue;
+ if (name == "Style"){
+ //retrieve default value from class attribute
+ DefaultStyle defStyle = thisType.GetCustomAttribute<DefaultStyle>();
+ if (defStyle != null)
+ defaultValue = defStyle.Path;
}else{
DefaultValueAttribute dv = (DefaultValueAttribute)pi.GetCustomAttribute (typeof(DefaultValueAttribute));
if (dv == null)
continue;
defaultValue = dv.Value;
- }
+ }
#endregion
il.Emit (OpCodes.Ldarg_0);