Beispiel #1
0
 public Action <T> GetSetter <T>(BindSetterContext ctx)
 {
     return(xaml =>
     {
         var fw = xaml.Cast <FrameworkElement>();
         var b = new Binding(ctx.Path);
         ctx.Get <IValueConverter>().Do(vc => b.Converter = vc);
         ctx.Get <bool>("oneway").Do(oneway => b.Mode = BindingMode.OneWay);
         fw.SetBinding(ctx.DependencyProperty, b);
     });
 }
Beispiel #2
0
        public static BindSetterContext NewBindSetterContext(this InvokeContext ctx, DependencyProperty depProp)
        {
            var bc    = new BindSetterContext(ctx.Values[0] != null ? ctx.Values[0].ToString() : ".", depProp);
            var value = ctx.GetValueForArgumentName("converter");

            if (value != null)
            {
                bc.Add("converter", value);
            }
            if (ctx.Name.StartsWith("OneWay"))
            {
                bc.Add("oneway", true);
            }

            value = ctx.GetValueForArgumentName("oneway");
            if (value != null)
            {
                bc.Add("oneway", (bool)value);
            }

            return(bc);
        }
Beispiel #3
0
 public void AddSetterWith(BindSetterContext setterContext)
 {
     _recordedActions.Add(_builder.SetterFactory.GetSetter <T>(setterContext));
 }