10using System.ComponentModel;
12using System.Reflection;
34 public UIView
Target {
get;
private set; }
39 public object Source {
get;
private set; }
54 public Func<object, object>
Convert {
get;
private set; }
69 public Binding(UIView target,
string targetProperty,
object source,
string sourceProperty,
BindingDirection bindingDirection)
70 : this(target, targetProperty, source, sourceProperty, null, null, bindingDirection)
82 public Binding(UIView target,
string targetProperty,
object source,
string sourceProperty, Func<object, object> convert,
BindingDirection bindingDirection)
83 : this(target, targetProperty, source, sourceProperty, convert, null, bindingDirection)
96 public Binding(UIView target,
string targetProperty,
object source,
string sourceProperty, Func<object, object> convert, Func<object, object> convertBack,
BindingDirection bindingDirection)
106 var editableControl =
Target as UIControl;
107 if (editableControl !=
null)
108 editableControl.EditingDidEnd += Target_EditingDidEnd;
110 var inpc =
Source as INotifyPropertyChanged;
112 inpc.PropertyChanged += Source_PropertyChanged;
122 void Source_PropertyChanged(
object sender, PropertyChangedEventArgs e)
132 void Target_EditingDidEnd(
object sender, EventArgs e)
134 var control = sender as UIControl;
135 if (control !=
null && !control.Selected)
151 var converted = Utilities.CoerceValue(
166 var converted = Utilities.CoerceValue(
178 var editableControl =
Target as UIControl;
179 if (editableControl !=
null)
180 editableControl.EditingDidEnd -= Target_EditingDidEnd;
182 var inpc =
Source as INotifyPropertyChanged;
184 inpc.PropertyChanged -= Source_PropertyChanged;
Contains an individual binding to tie a property on an Axml view to the property on a supplied object...
Binding(UIView target, string targetProperty, object source, string sourceProperty, Func< object, object > convert, Func< object, object > convertBack, BindingDirection bindingDirection)
Creates a new instance of the Binding class.
Func< object, object > Convert
A reference to a function to do a custom conversion from the source property to the target property.
System.Reflection.PropertyInfo TargetProperty
The PropertyInfo for the property on the target view that is being bound to.
Binding(UIView target, string targetProperty, object source, string sourceProperty, BindingDirection bindingDirection)
Creates a new instance of the Binding class.
UIView Target
The iOS view that is used by the binding.
Func< object, object > ConvertBack
A reference to a function to do a custom conversion from the target property to the source property.
BindingDirection BindingDirection
Indicates if this is read only or two way binding.
void Dispose()
Clears the bindings, references and event handlers.
object Source
The object that the view is bound to.
Binding(UIView target, string targetProperty, object source, string sourceProperty, Func< object, object > convert, BindingDirection bindingDirection)
Creates a new instance of the Binding class.
void UpdateTarget()
Updates the target with the current value in the source object.
System.Reflection.PropertyInfo SourceProperty
The PropertyInfo for the property on the source object that is being bound to.
void UpdateSource()
Updates the source with the current value in the target object.
PropertyInfo(string name)
Creates a new instance of this class.