10using System.ComponentModel;
23 public View
Target {
get;
private set; }
28 public object Source {
get;
private set; }
43 public Func<object, object>
Convert {
get;
private set; }
57 public Binding(View target,
string targetProperty,
object source,
string sourceProperty)
58 : this(target, targetProperty, source, sourceProperty, null, null)
69 public Binding(View target,
string targetProperty,
object source,
string sourceProperty, Func<object, object> convert)
70 : this(target, targetProperty, source, sourceProperty, convert, null)
82 public Binding(View target,
string targetProperty,
object source,
string sourceProperty, Func<object, object> convert, Func<object, object> convertBack)
91 Target.FocusChange += Target_FocusChange;
93 var inpc =
Source as INotifyPropertyChanged;
95 inpc.PropertyChanged += Source_PropertyChanged;
105 void Source_PropertyChanged(
object sender, PropertyChangedEventArgs e)
115 void Target_FocusChange(
object sender, View.FocusChangeEventArgs e)
129 var converted = Utilities.CoerceValue(
144 var converted = Utilities.CoerceValue(
156 Target.FocusChange -= Target_FocusChange;
158 var inpc =
Source as INotifyPropertyChanged;
160 inpc.PropertyChanged -= Source_PropertyChanged;
Contains an individual binding to tie a property on an Axml view to the property on a supplied object...
object Source
The object that the view is bound to.
Binding(View target, string targetProperty, object source, string sourceProperty, Func< object, object > convert, Func< object, object > convertBack)
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.
View Target
The Axml view that is used by the binding.
Binding(View target, string targetProperty, object source, string sourceProperty, Func< object, object > convert)
Creates a new instance of the Binding class.
void Dispose()
Clears the bindings, references and event handlers.
System.Reflection.PropertyInfo TargetProperty
The PropertyInfo for the property on the target view that is being bound to.
void UpdateSource()
Updates the source with the current value in the target object.
Func< object, object > Convert
A reference to a function to do a custom conversion from the source property to the target property.
Func< object, object > ConvertBack
A reference to a function to do a custom conversion from the target property to the source property.
Binding(View target, string targetProperty, object source, string sourceProperty)
Creates a new instance of the Binding class.
PropertyInfo(string name)
Creates a new instance of this class.