Esempio n. 1
0
        public Binding <TSource, TTarget> ObserveSourceEvent(UpdateTriggerMode mode = UpdateTriggerMode.PropertyChanged)
        {
            switch (mode)
            {
            case UpdateTriggerMode.LostFocus:
                return(ObserveSourceEvent <View.FocusChangeEventArgs>("FocusChange"));

            case UpdateTriggerMode.PropertyChanged:
                return(CheckControlSource());
            }

            return(this);
        }
Esempio n. 2
0
        public Binding <TSource, TTarget> ObserveTargetEvent(UpdateTriggerMode mode)
        {
            switch (mode)
            {
            case UpdateTriggerMode.LostFocus:
                throw new ArgumentException(
                          "UpdateTriggerMode.LostFocus is only supported in Android at this time",
                          nameof(mode));

            case UpdateTriggerMode.PropertyChanged:
                return(CheckControlTarget());
            }

            return(this);
        }
Esempio n. 3
0
 /// <summary>
 /// Define when the binding should be evaluated when the bound target object
 /// is a control. Because Xamarin controls are not DependencyObjects, the
 /// bound property will not automatically update the binding attached to it. Instead,
 /// use this method to define which of the control's events should be observed.
 /// </summary>
 /// <param name="mode">Defines the binding's update mode. Use
 /// <see cref="UpdateTriggerMode.LostFocus"/> to update the binding when
 /// the source control loses the focus. You can also use
 /// <see cref="UpdateTriggerMode.PropertyChanged"/> to update the binding
 /// when the source control's property changes.
 /// NOTE: At this time the PropertyChanged mode is inactive on iOS. Use
 /// <see cref="ObserveTargetEvent(string)"/> instead.
 /// </param>
 /// <returns>The Binding instance.</returns>
 /// <exception cref="InvalidOperationException">When this method is called
 /// on a OneTime or a OneWay binding. This exception can
 /// also be thrown when the source object is null or has already been
 /// garbage collected before this method is called.</exception>
 public Binding <TSource, TTarget> UpdateTargetTrigger(UpdateTriggerMode mode)
 {
     return(ObserveTargetEvent(mode));
 }