public void Handle(InvokeContext ctx) { var propertyName = ctx.Name; var propertyType = ctx.XamlType.GetPropertyType(propertyName); var values = ctx.NormalizeToBuiltXaml(c => c.Values[0]).MustHaveValue(); ctx.AddSetterWith(new SetterContext(propertyName, propertyType, values.Length > 1 ? values : values[0])); }
public void Handle(InvokeContext ctx) { FailIfIAddChildIsMissing(ctx); var values = ctx.Values.Select(v => ctx.NormalizeToBuiltXaml(_ => v).MustHaveValue()).Flatten(); foreach (var value in values) { var v = value; ctx.AddSetterWith<IAddChild>(ac => { if (v.CanBeCastTo<string>()) ac.AddText((string) v); else ac.AddChild(v); }); } }
public void Handle(InvokeContext ctx) { FailIfIAddChildIsMissing(ctx); var values = ctx.Values.Select(v => ctx.NormalizeToBuiltXaml(_ => v).MustHaveValue()).Flatten(); foreach (var value in values) { var v = value; ctx.AddSetterWith <IAddChild>(ac => { if (v.CanBeCastTo <string>()) { ac.AddText((string)v); } else { ac.AddChild(v); } }); } }