public static void AddLinqBinding <TViewModel, TProperty>( this IMvxBindingContextOwner owner, TViewModel viewModel, Expression <Func <TViewModel, TProperty> > propertyExpression, Action <TProperty> action) where TViewModel : INotifyPropertyChanged { var propertyInfo = GetPropertyInfoFromExpression <TViewModel, TProperty>(propertyExpression); var binding = new LinqBinding <TViewModel, TProperty>(viewModel, propertyInfo, action); owner.AddBinding(owner, binding); }
// add whenever something changes public static void AddLinqBinding <TViewModel, TProperty>( this IMvxBindingContextOwner owner, TViewModel viewModel, Expression <Func <TViewModel, TProperty> > propertyExpression, Action <TProperty> action) where TViewModel : INotifyPropertyChanged { //Action createBinding = () => // { var propertyInfo = GetPropertyInfoFromExpression <TViewModel, TProperty>(propertyExpression); var binding = new LinqBinding <TViewModel, TProperty>(viewModel, propertyInfo, action); owner.AddBinding(owner, binding); //owner.CreateBinding(binding); // }; //viewModel.PropertyChanged += (sender, args) => // createBinding(); //createBinding(); }