コード例 #1
0
 /// <summary>
 /// Control's OnPropertyBound event handler extension.
 /// </summary>
 /// <param name="prop">Property object.</param>
 /// <param name="row">The data row context, if in a list.</param>
 public virtual void OnPropertyBound(DateTimeProperty prop, DataRow row)
 {
     if (BaseBinding.Create(txt_DateTime) is BasePropertyBinding pb)
     {
         pb.BindTo(prop, row);
     }
 }
コード例 #2
0
ファイル: BindableForm.cs プロジェクト: Guillemsc/Fast
        public void RemoveBinding(BaseBinding binding)
        {
            if (binding == null)
            {
                return;
            }

            bindings.Remove(binding);
        }
コード例 #3
0
ファイル: BindableForm.cs プロジェクト: Guillemsc/Fast
        public void AddBinding(BaseBinding binding)
        {
            if (binding == null)
            {
                return;
            }

            RemoveBinding(binding);

            bindings.Add(binding);
        }
コード例 #4
0
ファイル: BindableForm.cs プロジェクト: Guillemsc/Fast
        public void RiseProperty(string parameter_name, object variable = null)
        {
            for (int i = 0; i < bindings.Count; ++i)
            {
                BaseBinding curr_binding = bindings[i];

                if (curr_binding.BindingName != parameter_name)
                {
                    continue;
                }

                curr_binding.RiseValue(variable);
            }
        }
コード例 #5
0
        public Type?InferDataContextTypeFromBindings(IEnumerable <IDataBinding> bindings,
                                                     Type?currentGenericArg)
        {
            foreach (var binding in bindings)
            {
                switch (binding)
                {
                case DeferredPropertyBinding deferredPropertyBinding:

                    switch (deferredPropertyBinding.TargetPropertyName)
                    {
                    case nameof(IItemsControl.ItemsSource) when currentGenericArg != null:

                        var sourceProp = BaseBinding.GetBindingProperty(currentGenericArg,
                                                                        deferredPropertyBinding.SourcePropertyName);


                        if (!(sourceProp?.PropertyType is { } sourcePropType) ||
                            !typeof(IEnumerable).IsAssignableFrom(sourcePropType) ||
                            !sourcePropType.IsGenericType)
                        {
                            continue;
                        }

                        var srcPropGenerics = sourcePropType.GetGenericArguments();
                        if (srcPropGenerics == null || srcPropGenerics.Length == 0)
                        {
                            continue;
                        }

                        if (srcPropGenerics.Length != 1)
                        {
                            throw new NotImplementedException();
                        }

                        return(srcPropGenerics[0]);

                    case nameof(IBindableElement.DataContext):

                        if (currentGenericArg == null)
                        {
                            break;
                        }

                        var dcProp = BaseBinding.GetBindingProperty(currentGenericArg,
                                                                    deferredPropertyBinding.SourcePropertyName);

                        if (dcProp is { } validProp)
                        {
                            return(validProp.PropertyType);
                        }

                        break;
                    }

                    break;
                }
            }

            return(currentGenericArg);
        }
コード例 #6
0
 public BindingsRegistry RegisterWithConfiguration(BaseBinding baseBinding)
 {
     bindings.Add(baseBinding, true);
     return(this);
 }
コード例 #7
0
 public BindingsRegistry Register(BaseBinding baseBinding)
 {
     bindings.Add(baseBinding, false);
     return(this);
 }
コード例 #8
0
ファイル: FormBindingCE.cs プロジェクト: Guillemsc/Fast
 protected void OnEnable()
 {
     target_script = (BaseBinding)target;
 }