public void Handle(InvokeContext ctx) { GuardAgainstSignatureFailures(ctx); var attachProp = (DependencyProperty)ctx.Values[0]; if (ctx.IsArgumentNameSpecified("path")) ctx.AddSetterWith(ctx.NewBindSetterContext(attachProp)); else { var value = ctx.Values[1]; ctx.AddSetterWith<DependencyObject>(xaml => xaml.SetValue(attachProp, value)); } }
public void Handle(InvokeContext ctx) { GuardAgainstSignatureFailures(ctx); var attachProp = (DependencyProperty)ctx.Values[0]; if (ctx.IsArgumentNameSpecified("path")) { ctx.AddSetterWith(ctx.NewBindSetterContext(attachProp)); } else { var value = ctx.Values[1]; ctx.AddSetterWith <DependencyObject>(xaml => xaml.SetValue(attachProp, value)); } }
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) { var propertyName = ctx.Name.Replace("Static", ""); var propertyType = ctx.XamlType.GetPropertyType(propertyName); ctx.AddSetterWith(new SetterContext(propertyName, propertyType, new StaticResource(ctx.Values[0]))); }
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) { FailIfXamlNotAFrameworkElement(ctx); var propertyName = ctx.Name.Replace("OneWayBind", "").Replace("Bind", ""); var depProp = ctx.XamlType .FindDependencyProperty(propertyName) .MustHaveValue(new ArgumentException("No DependencyProperty '{0}' found on type '{1}'".Fmt(propertyName, ctx.XamlType.Name))); ctx.AddSetterWith(ctx.NewBindSetterContext(depProp)); }
public void Handle(InvokeContext ctx) { FailIfXamlNotAFrameworkElement(ctx); var propertyName = ctx.Name.Replace("OneWayBind", "").Replace("Bind", ""); var depProp = ctx.XamlType .FindDependencyProperty(propertyName) .MustHaveValue(new ArgumentException("No DependencyProperty '{0}' found on type '{1}'".Fmt(propertyName, ctx.XamlType.Name))); ctx.AddSetterWith(ctx.NewBindSetterContext(depProp)); }
public void Handle(InvokeContext ctx) { FailIfXamlNotAFrameworkElement(ctx); object value = null; ctx.Values[1].Maybe( v => v.Cast<Func<XamlBuilder, Xaml>>() .Get(func => func(ctx.Builder).Create()) .Do(xaml => value = xaml), v => v.Cast<Xaml>() .Get(x => x.Create()) .Do(xaml => value = xaml) ); ctx.AddSetterWith<FrameworkElement>(fw => fw.Resources.Add(ctx.Values[0], value ?? ctx.Values[1])); }
public void Handle(InvokeContext ctx) { FailIfXamlNotAFrameworkElement(ctx); object value = null; ctx.Values[1].Maybe( v => v.Cast <Func <XamlBuilder, Xaml> >() .Get(func => func(ctx.Builder).Create()) .Do(xaml => value = xaml), v => v.Cast <Xaml>() .Get(x => x.Create()) .Do(xaml => value = xaml) ); ctx.AddSetterWith <FrameworkElement>(fw => fw.Resources.Add(ctx.Values[0], value ?? ctx.Values[1])); }
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); } }); } }
public void Handle(InvokeContext ctx) { var propertyName = ctx.Name.Replace("Static", ""); var propertyType = ctx.XamlType.GetPropertyType(propertyName); ctx.AddSetterWith(new SetterContext(propertyName, propertyType, new StaticResource(ctx.Values[0]))); }