(LogicalParent as GraphicObject).DataSource : dataSource;
}
}
- [XmlAttributeAttribute][DefaultValue(null)]
+ [XmlAttributeAttribute]
public virtual string Style {
get { return style; }
set {
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;
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);
namespace Crow
{
-// [AttributeUsage(AttributeTargets.Class)]
+ [AttributeUsage(AttributeTargets.Class)]
public class TemplateAttribute : Attribute
{
public string Path = "";
}
}
[AttributeUsage(AttributeTargets.Class)]
- public class StyleAttribute : Attribute
+ public class DefaultStyle : TemplateAttribute
{
- public string PropertyName = "";
- public object DefaultValue = null;
- public StyleAttribute(string _property, object _defValue){
- PropertyName = _property;
- DefaultValue = _defValue;
- }
+ public DefaultStyle(string path) : base(path){}
}
[AttributeUsage(AttributeTargets.Class)]
public class DefaultTemplate : TemplateAttribute
public DefaultTemplate(string path) : base(path){}
}
[AttributeUsage(AttributeTargets.Class)]
- public class DefaultOverlayTemplate : TemplateAttribute
- {
- public DefaultOverlayTemplate(string path) : base(path){}
- }
- [AttributeUsage(AttributeTargets.Class)]
public class DefaultItemTemplate : TemplateAttribute
{
public DefaultItemTemplate(string path) : base(path){}