Exemple #1
0
 protected void SetBinding(
     ref MVVMBinding binding, MVVMBinding value,
     MVVMFunc <object> getTargetValue = null, Action <object> setTargetValue = null,
     bool isInteractive = false, bool isText       = false,
     bool isDataContext = false, MVVMAction unbind = null, [CallerMemberName] string propertyName = null
     )
 {
     if (!isDataContext && binding != null)
     {
         Bindings.Remove(binding);
     }
     binding = value;
     if (binding == null)
     {
         return;
     }
     binding.Control = this;
     if (propertyName == null)
     {
         propertyName = MVVMAPI.GetCallerMemberName();
     }
     binding.TargetPropertyName         = propertyName;
     binding.IsDataContext              = isDataContext;
     binding.OnGetTargetValue           = getTargetValue;
     binding.OnSetTargetValue           = setTargetValue;
     binding.OnUnbind                   = unbind;
     binding.DefaultMode                = isInteractive ? MVVMBindingMode.TwoWay : MVVMBindingMode.OneWay;
     binding.DefaultUpdateSourceTrigger = isText ? MVVMUpdateSourceTrigger.LostFocus : MVVMUpdateSourceTrigger.PropertyChanged;
     if (!isDataContext)
     {
         Bindings.Add(binding);
     }
 }
Exemple #2
0
 public MVVMDataTemplate(MVVMFunc <MVVMControlBase> build)
 {
     Build = build;
 }