NElement AssignAttachedProps(NElement result) { if (result == null) #if XAML { result = new NXaml <StackPanel>(); } #else { throw new ArgumentNullException(nameof(result)); } #endif for (var i = _props.Head; i != null; i = i.Next) { if (Ambients.Contains(i.Key)) { result.Set(i.Key, i._value); } } return(result); }
public static NElement CreateElement(Type type, object key = null) { var result = default(NElement); if (type.IsSubclassOf(typeof(NClass))) { result = Activator.CreateInstance(type) as NElement; } else { result = new NXaml(type); } if (key != null) { return(result.Key(key)); } return(result); }
public static NElement CreateElement <T>(object key = null) where T : new() { var result = default(NElement); if (typeof(T).IsSubclassOf(typeof(NClass))) { result = Ctor <T> .New() as NElement; } else { result = new NXaml <T>(); } if (key != null) { return(result.Key(key)); } return(result); }