Пример #1
0
 protected void SetBinding(
     ref MVVMBinding binding, MVVMBinding value,
     MVVMFunc <object> getTargetValue = null, Action <object> setTargetValue = null,
     MVVMAction unbind           = null,
     MVVMBindingMode defaultMode = MVVMBindingMode.OneWay,
     MVVMUpdateSourceTrigger defaultUpdateSourceTrigger = MVVMUpdateSourceTrigger.PropertyChanged,
     bool isDataContext = false, [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                = defaultMode;
     binding.DefaultUpdateSourceTrigger = defaultUpdateSourceTrigger;
     if (!isDataContext)
     {
         Bindings.Add(binding);
     }
 }
Пример #2
0
 public MVVMBinding(
     MVVMBindingMode mode = MVVMBindingMode.Default,
     MVVMUpdateSourceTrigger updateSourceTrigger = MVVMUpdateSourceTrigger.Default,
     string path  = null,
     object value = null,
     MVVMRelativeSource relativeSource = null,
     string elementName         = null,
     MVVMControlBase element    = null,
     bool validatesOnExceptions = false
     )
 {
     if (element != null)
     {
         Type = MVVMBindingType.Element;
     }
     else if (elementName != null)
     {
         Type = MVVMBindingType.ElementName;
     }
     else if (relativeSource != null)
     {
         Type = MVVMBindingType.RelativeSource;
     }
     else if (value != null)
     {
         Type = MVVMBindingType.Value;
     }
     else
     {
         Type = MVVMBindingType.Path;
     }
     _Mode = mode;
     _UpdateSourceTrigger = updateSourceTrigger;
     Path                  = path;
     TargetValue           = value;
     ElementName           = elementName;
     Element               = element;
     ValidatesOnExceptions = validatesOnExceptions;
 }
Пример #3
0
 public MVVMBinding(MVVMControlBase element, string path, MVVMBindingMode mode, MVVMUpdateSourceTrigger updateSourceTrigger) : this(element, path, mode)
 {
     _UpdateSourceTrigger = updateSourceTrigger;
 }
Пример #4
0
 public MVVMBinding(MVVMRelativeSource relativeSource, MVVMBindingMode mode) : this(relativeSource) {
     _Mode = mode;
 }
Пример #5
0
 public MVVMBinding(MVVMControlBase element, MVVMBindingMode mode) : this(element) {
     _Mode = mode;
 }
Пример #6
0
 public MVVMBinding(MVVMControlBase element, string path, MVVMBindingMode mode) : this(element, path)
 {
     _Mode = mode;
 }
Пример #7
0
 public MVVMBinding(string elementName, string path, MVVMBindingMode mode) : this(elementName, path)
 {
     _Mode = mode;
 }
Пример #8
0
 public MVVMBinding(string elementName, string path, MVVMBindingMode mode, MVVMUpdateSourceTrigger updateSourceTrigger) : this(elementName, path, mode)
 {
     _UpdateSourceTrigger = updateSourceTrigger;
 }
Пример #9
0
 public MVVMBinding(MVVMRelativeSource relativeSource, string path, MVVMBindingMode mode) : this(relativeSource, path)
 {
     _Mode = mode;
 }
Пример #10
0
 public MVVMBinding(MVVMRelativeSource relativeSource, string path, MVVMBindingMode mode, MVVMUpdateSourceTrigger updateSourceTrigger)
     : this(relativeSource, path, mode)
 {
     _UpdateSourceTrigger = updateSourceTrigger;
 }
Пример #11
0
 public MVVMBinding(object value, MVVMBindingMode mode, MVVMUpdateSourceTrigger updateSourceTrigger) : this(value, mode)
 {
     _UpdateSourceTrigger = updateSourceTrigger;
 }
Пример #12
0
 public MVVMBinding(MVVMControl element, MVVMBindingMode mode, MVVMUpdateSourceTrigger updateSourceTrigger) : this(element, mode)
 {
     _UpdateSourceTrigger = updateSourceTrigger;
 }
Пример #13
0
 public MVVMBinding(object value, MVVMBindingMode mode) : this(value) {
     _Mode = mode;
 }
Пример #14
0
 public MVVMBinding(string path, MVVMBindingMode mode, MVVMUpdateSourceTrigger updateSourceTrigger) : this(path, mode)
 {
     _UpdateSourceTrigger = updateSourceTrigger;
 }
Пример #15
0
 public MVVMBinding(string path, MVVMBindingMode mode) : this(path) {
     _Mode = mode;
 }
Пример #16
0
 public MVVMBinding(MVVMBindingMode mode, MVVMUpdateSourceTrigger updateSourceTrigger) : this(mode) {
     _UpdateSourceTrigger = updateSourceTrigger;
 }
Пример #17
0
 public MVVMBinding(MVVMBindingMode mode) : this()
 {
     _Mode = mode;
 }