private static void GuardAgainstSignatureFailures(InvokeContext ctx)
 {
     if (ctx.Values.Length < 2 ||
         !ctx.Values[0].CanBeCastTo<DependencyProperty>())
         ThrowException();
     if (ctx.IsArgumentNameSpecified("path"))
         return;
     if (!((DependencyProperty)ctx.Values[0]).IsValidType(ctx.Values[1]))
         ThrowException();
 }
        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));
            }
        }
 private static void GuardAgainstSignatureFailures(InvokeContext ctx)
 {
     if (ctx.Values.Length < 2 ||
         !ctx.Values[0].CanBeCastTo <DependencyProperty>())
     {
         ThrowException();
     }
     if (ctx.IsArgumentNameSpecified("path"))
     {
         return;
     }
     if (!((DependencyProperty)ctx.Values[0]).IsValidType(ctx.Values[1]))
     {
         ThrowException();
     }
 }