public static T Bind <T, TViewModel>(this T element, MvxInlineBindingTarget <TViewModel> target, string targetPath, string sourcePath, IMvxValueConverter converter = null, object converterParameter = null, object fallbackValue = null, MvxBindingMode mode = MvxBindingMode.Default) { if (string.IsNullOrEmpty(targetPath)) { targetPath = MvxBindingSingletonCache.Instance.DefaultBindingNameLookup.DefaultFor(typeof(T)); } var bindingDescription = new MvxBindingDescription( targetPath, sourcePath, converter, converterParameter, fallbackValue, mode); target.BindingContextOwner.AddBinding(element, bindingDescription); return(element); }
public static void BindLanguage(this IMvxBindingContextOwner owner , object target , string targetPropertyName , string sourceKey , string sourcePropertyName = null , string fallbackValue = null , string converterName = null , MvxBindingMode bindingMode = MvxBindingMode.OneTime) { converterName = converterName ?? LanguageParser.DefaultConverterName; sourcePropertyName = sourcePropertyName ?? LanguageParser.DefaultTextSourceName; var converter = ValueConverterLookup.Find(converterName); var bindingDescription = new MvxBindingDescription { TargetName = targetPropertyName, Source = new MvxPathSourceStepDescription { SourcePropertyPath = sourcePropertyName, Converter = converter, ConverterParameter = sourceKey, FallbackValue = fallbackValue, }, Mode = bindingMode }; owner.AddBinding(target, bindingDescription); }
private static void Bind(this IMvxBindingContextOwner bindingOwner, object target, IMvxValueConverter converter, object converterParameter, object fallbackValue, MvxBindingMode mode, IMvxParsedExpression parsedTargetPath, IMvxParsedExpression parsedSourcePath) { bindingOwner.Bind(target, converter, converterParameter, fallbackValue, mode, parsedTargetPath.Print(), parsedSourcePath.Print()); }
protected static BindingMode ConvertMode(MvxBindingMode mode, Type propertyType) { switch (mode) { case MvxBindingMode.Default: // if we return TwoWay for ImageSource then we end up in // problems with WP7 not doing the auto-conversion // see some of my angst in http://stackoverflow.com/questions/16752242/how-does-xaml-create-the-string-to-bitmapimage-value-conversion-when-binding-to/16753488#16753488 // Note: if we discover other issues here, then we should make a more flexible solution if (propertyType == typeof(ImageSource)) { return(BindingMode.OneWay); } return(BindingMode.TwoWay); case MvxBindingMode.TwoWay: return(BindingMode.TwoWay); case MvxBindingMode.OneWay: return(BindingMode.OneWay); case MvxBindingMode.OneTime: return(BindingMode.OneTime); case MvxBindingMode.OneWayToSource: MvxLogHost.GetLog <MvxWindowsBindingCreator>()?.Log(LogLevel.Warning, "WinPhone doesn't support OneWayToSource"); return(BindingMode.TwoWay); default: throw new ArgumentOutOfRangeException(nameof(mode)); } }
public static MvxBindingMode IfDefault(this MvxBindingMode bindingMode, MvxBindingMode modeIfDefault) { if (bindingMode == MvxBindingMode.Default) { return(modeIfDefault); } return(bindingMode); }
public MvxBindingDescription(string targetName, string sourcePropertyPath, IMvxValueConverter converter, object converterParameter, object fallbackValue, MvxBindingMode mode) { TargetName = targetName; SourcePropertyPath = sourcePropertyPath; Converter = converter; ConverterParameter = converterParameter; FallbackValue = fallbackValue; Mode = mode; }
public MvxBindingDescription(string targetName, string sourcePropertyPath, IMvxValueConverter converter, object converterParameter, object fallbackValue, MvxBindingMode mode) { TargetName = targetName; SourcePropertyPath = sourcePropertyPath; Converter = converter; ConverterParameter = converterParameter; FallbackValue = fallbackValue; Mode = mode; }
public static void BindLanguage <TTarget>(this IMvxBindingContextOwner owner , TTarget target , string sourceKey , MvxBindingMode bindingMode) { var targetPath = MvxBindingSingletonCache.Instance?.DefaultBindingNameLookup.DefaultFor(typeof(TTarget)); owner.BindLanguage(target, targetPath, sourceKey, bindingMode: bindingMode); }
public static T Bind <T, TViewModel>(this T element, MvxInlineBindingTarget <TViewModel> target, Expression <Func <TViewModel, object> > sourcePropertyPath, IMvxValueConverter converter, object converterParameter = null, object fallbackValue = null, MvxBindingMode mode = MvxBindingMode.Default) { return(element.Bind(target, null, sourcePropertyPath, converter, converterParameter, fallbackValue, mode)); }
public static void BindLanguage(this IMvxBindingContextOwner owner , string targetPropertyName , string sourceKey , string sourcePropertyName = null , string fallbackValue = null , string converterName = null , MvxBindingMode bindingMode = MvxBindingMode.OneTime) { owner.BindLanguage(owner, targetPropertyName, sourceKey, sourcePropertyName, fallbackValue, converterName, bindingMode); }
// TODO: need to test other things like: // - event subscription (hard to do through Moq) // - use of valueConverter // - one time subscription // - fallback values // - setup again on DataContext change // - dispose mechanism private void TestCommon(MvxBindingMode bindingMode, bool expectSourceBinding, bool expectTargetBinding) { ClearAll(); var mockSourceBindingFactory = new Mock <IMvxSourceBindingFactory>(); Ioc.RegisterSingleton(mockSourceBindingFactory.Object); var mockTargetBindingFactory = new Mock <IMvxTargetBindingFactory>(); Ioc.RegisterSingleton(mockTargetBindingFactory.Object); var sourceText = "sourceText"; var targetName = "targetName"; var source = new { Value = 1 }; var target = new { Value = 2 }; var converterParameter = new { Value = 3 }; var fallbackValue = new { Value = 4 }; var converter = new Mock <IMvxValueConverter>(); var bindingDescription = new MvxBindingDescription { Converter = converter.Object, ConverterParameter = converterParameter, FallbackValue = fallbackValue, Mode = bindingMode, SourcePropertyPath = sourceText, TargetName = targetName }; var mockSourceBinding = new Mock <IMvxSourceBinding>(); var mockTargetBinding = new Mock <IMvxTargetBinding>(); mockSourceBindingFactory .Setup(x => x.CreateBinding(It.Is <object>(s => s == source), It.Is <string>(s => s == sourceText))) .Returns((object a, string b) => mockSourceBinding.Object); mockTargetBindingFactory .Setup(x => x.CreateBinding(It.Is <object>(s => s == target), It.Is <string>(s => s == targetName))) .Returns((object a, string b) => mockTargetBinding.Object); var request = new MvxBindingRequest(source, target, bindingDescription); var toTest = new MvxFullBinding(request); //var sourceBindingTimes = expectSourceBinding ? Times.Once() : Times.Never(); //mockSourceBinding.Verify(x => x.Changed += It.IsAny<EventHandler<MvxSourcePropertyBindingEventArgs>>(), sourceBindingTimes); mockSourceBindingFactory .Verify(x => x.CreateBinding(It.Is <object>(s => s == source), It.Is <string>(s => s == sourceText)), Times.Once()); //var targetBindingTimes = expectSourceBinding ? Times.Once() : Times.Never(); //mockTargetBinding.Verify(x => x.ValueChanged += It.IsAny<EventHandler<MvxTargetChangedEventArgs>>(), targetBindingTimes); mockTargetBindingFactory .Verify(x => x.CreateBinding(It.Is <object>(s => s == target), It.Is <string>(s => s == targetName)), Times.Once()); }
public static void Bind <TTarget, TSource>(this TTarget bindingOwner, Expression <Func <TSource, object> > sourcePropertyPath, IMvxValueConverter converter = null, object converterParameter = null, object fallbackValue = null, MvxBindingMode mode = MvxBindingMode.Default) where TTarget : class, IMvxBindingContextOwner { bindingOwner.Bind(bindingOwner, string.Empty, sourcePropertyPath, converter, converterParameter, fallbackValue, mode); }
public static void BindLanguage <TTarget, TViewModel>(this IMvxBindingContextOwner owner , TTarget target , string sourceKey , Expression <Func <TViewModel, IMvxTextProvider> > textProvider , MvxBindingMode bindingMode = MvxBindingMode.OneTime) { var parser = PropertyExpressionParser; var targetPath = MvxBindingSingletonCache.Instance.DefaultBindingNameLookup.DefaultFor(typeof(TTarget)); var sourcePath = parser.Parse(textProvider).Print(); owner.BindLanguage(target, targetPath, sourceKey, sourcePath, bindingMode: bindingMode); }
// TODO: need to test other things like: // - event subscription (hard to do through Moq) // - use of valueConverter // - one time subscription // - fallback values // - setup again on DataContext change // - dispose mechanism private void TestCommon(MvxBindingMode bindingMode, bool expectSourceBinding, bool expectTargetBinding) { ClearAll(); var mockSourceBindingFactory = new Mock<IMvxSourceBindingFactory>(); Ioc.RegisterSingleton(mockSourceBindingFactory.Object); var mockTargetBindingFactory = new Mock<IMvxTargetBindingFactory>(); Ioc.RegisterSingleton(mockTargetBindingFactory.Object); var sourceText = "sourceText"; var targetName = "targetName"; var source = new {Value = 1}; var target = new {Value = 2}; var converterParameter = new {Value = 3}; var fallbackValue = new {Value = 4}; var converter = new Mock<IMvxValueConverter>(); var bindingDescription = new MvxBindingDescription { Converter = converter.Object, ConverterParameter = converterParameter, FallbackValue = fallbackValue, Mode = bindingMode, SourcePropertyPath = sourceText, TargetName = targetName }; var mockSourceBinding = new Mock<IMvxSourceBinding>(); var mockTargetBinding = new Mock<IMvxTargetBinding>(); mockSourceBindingFactory .Setup(x => x.CreateBinding(It.Is<object>(s => s == source), It.Is<string>(s => s == sourceText))) .Returns((object a, string b) => mockSourceBinding.Object); mockTargetBindingFactory .Setup(x => x.CreateBinding(It.Is<object>(s => s == target), It.Is<string>(s => s == targetName))) .Returns((object a, string b) => mockTargetBinding.Object); var request = new MvxBindingRequest(source, target, bindingDescription); var toTest = new MvxFullBinding(request); //var sourceBindingTimes = expectSourceBinding ? Times.Once() : Times.Never(); //mockSourceBinding.Verify(x => x.Changed += It.IsAny<EventHandler<MvxSourcePropertyBindingEventArgs>>(), sourceBindingTimes); mockSourceBindingFactory .Verify(x => x.CreateBinding(It.Is<object>(s => s == source), It.Is<string>(s => s == sourceText)), Times.Once()); //var targetBindingTimes = expectSourceBinding ? Times.Once() : Times.Never(); //mockTargetBinding.Verify(x => x.ValueChanged += It.IsAny<EventHandler<MvxTargetChangedEventArgs>>(), targetBindingTimes); mockTargetBindingFactory .Verify(x => x.CreateBinding(It.Is<object>(s => s == target), It.Is<string>(s => s == targetName)), Times.Once()); }
public static void Bind <TTarget, TSource>(this TTarget target, Expression <Func <TTarget, object> > targetProperty, Expression <Func <TSource, object> > sourcePropertyPath, string converterName, object converterParameter = null, object fallbackValue = null, MvxBindingMode mode = MvxBindingMode.Default) where TTarget : class, IMvxBindingContextOwner { var converter = ValueConverterLookup.Find(converterName); target.Bind(target, targetProperty, sourcePropertyPath, converter, converterParameter, fallbackValue, mode); }
public MvxBindingDescription(string targetName, string sourcePropertyPath, IMvxValueConverter converter, object converterParameter, object fallbackValue, MvxBindingMode mode) { this.TargetName = targetName; this.Mode = mode; this.Source = new MvxPathSourceStepDescription { SourcePropertyPath = sourcePropertyPath, Converter = converter, ConverterParameter = converterParameter, FallbackValue = fallbackValue, }; }
public static T Bind <T, TViewModel>(this T element, MvxInlineBindingTarget <TViewModel> target, Expression <Func <T, object> > targetPropertyPath, Expression <Func <TViewModel, object> > sourcePropertyPath, string converterName = null, object converterParameter = null, object fallbackValue = null, MvxBindingMode mode = MvxBindingMode.Default) { var converter = MvxBindingSingletonCache.Instance.ValueConverterLookup.Find(converterName); return(element.Bind(target, targetPropertyPath, sourcePropertyPath, converter, converterParameter, fallbackValue, mode)); }
public static void BindLanguage <TTarget>(this IMvxBindingContextOwner owner , TTarget target , Expression <Func <TTarget, object> > targetPropertyExpression , string sourceKey , string sourcePropertyName = null , string fallbackValue = null , string converterName = null , MvxBindingMode bindingMode = MvxBindingMode.OneTime) { var parser = PropertyExpressionParser; var parsedTargetPath = parser.Parse(targetPropertyExpression); var parsedTargetPathText = parsedTargetPath.Print(); owner.BindLanguage(target, parsedTargetPathText, sourceKey, sourcePropertyName, fallbackValue, converterName, bindingMode); }
public static T Bind <T, TViewModel>(this T element, MvxInlineBindingTarget <TViewModel> target, Expression <Func <T, object> > targetPropertyPath, Expression <Func <TViewModel, object> > sourcePropertyPath, IMvxValueConverter converter, object converterParameter = null, object fallbackValue = null, MvxBindingMode mode = MvxBindingMode.Default) { var parser = MvxBindingSingletonCache.Instance.PropertyExpressionParser; var sourcePath = parser.Parse(sourcePropertyPath).Print(); var targetPath = targetPropertyPath == null ? null : parser.Parse(targetPropertyPath).Print(); return(element.Bind(target, targetPath, sourcePath, converter, converterParameter, fallbackValue, mode)); }
private static void Bind(this IMvxBindingContextOwner bindingOwner, object target, IMvxValueConverter converter, object converterParameter, object fallbackValue, MvxBindingMode mode, string parsedTargetPath, string parsedSourcePath) { var description = new MvxBindingDescription { TargetName = parsedTargetPath, SourcePropertyPath = parsedSourcePath, Converter = converter, ConverterParameter = converterParameter, FallbackValue = fallbackValue, Mode = mode }; bindingOwner.AddBinding(target, description); }
public static void Bind <TTarget, TSource>(this IMvxBindingContextOwner bindingOwner, TTarget target, Expression <Func <TTarget, object> > targetProperty, Expression <Func <TSource, object> > sourcePropertyPath, IMvxValueConverter converter = null, object converterParameter = null, object fallbackValue = null, MvxBindingMode mode = MvxBindingMode.Default) where TTarget : class { var parser = PropertyExpressionParser; var parsedTargetPath = parser.Parse(targetProperty); var parsedSource = parser.Parse(sourcePropertyPath); bindingOwner.Bind(target, converter, converterParameter, fallbackValue, mode, parsedTargetPath, parsedSource); }
public PerformSimpleTestParams( string sourcePath, string targetName, bool useInlinePath, MvxBindingMode bindingMode, bool testBindingMode, string converter, KeyValuePair <string, object> converterParameterValue, KeyValuePair <string, object> fallbackValue) { _source = sourcePath; _useInlinePath = useInlinePath; _target = targetName; _bindingMode = bindingMode; _testBindingMode = testBindingMode; _converter = converter; _converterParameterValue = converterParameterValue; _fallbackValue = fallbackValue; }
public static bool RequireTargetUpdateOnFirstBind(this MvxBindingMode bindingMode) { switch (bindingMode) { case MvxBindingMode.Default: MvxBindingLog.Warning("Mode of default seen for binding - assuming TwoWay"); return(true); case MvxBindingMode.OneWay: case MvxBindingMode.OneTime: case MvxBindingMode.TwoWay: return(true); case MvxBindingMode.OneWayToSource: return(false); default: throw new MvxException("Unexpected ActualBindingMode"); } }
public static MvxBindingMode ToMvx(this BindingMode mode, MvxBindingMode ifDefault = MvxBindingMode.Default) { switch (mode) { case BindingMode.Default: return(ifDefault); case BindingMode.TwoWay: return(MvxBindingMode.TwoWay); case BindingMode.OneWay: return(MvxBindingMode.OneWay); case BindingMode.OneWayToSource: return(MvxBindingMode.OneWayToSource); default: throw new ArgumentOutOfRangeException("mode"); } }
public static bool RequiresTargetObservation(this MvxBindingMode bindingMode) { switch (bindingMode) { case MvxBindingMode.Default: MvxBindingTrace.Trace(MvxTraceLevel.Warning, "Mode of default seen for binding - assuming OneWay"); return(true); case MvxBindingMode.OneWay: case MvxBindingMode.OneTime: return(false); case MvxBindingMode.TwoWay: case MvxBindingMode.OneWayToSource: return(true); default: throw new MvxException("Unexpected ActualBindingMode"); } }
public static void Bind <TTarget, TSource>(this IMvxBindingContextOwner bindingOwner, TTarget target, string eventOrPropertyName, Expression <Func <TSource, object> > sourcePropertyPath, IMvxValueConverter converter = null, object converterParameter = null, object fallbackValue = null, MvxBindingMode mode = MvxBindingMode.Default) where TTarget : class { var parser = PropertyExpressionParser; var parsedSource = parser.Parse(sourcePropertyPath); if (string.IsNullOrEmpty(eventOrPropertyName)) { eventOrPropertyName = DefaultBindingNameLookup.DefaultFor(typeof(TTarget)); } bindingOwner.Bind(target, converter, converterParameter, fallbackValue, mode, eventOrPropertyName, parsedSource.Print()); }
protected static BindingMode ConvertMode(MvxBindingMode mode, Type propertyType) { switch (mode) { case MvxBindingMode.Default: // if we return TwoWay for ImageSource then we end up in // problems with WP7 not doing the auto-conversion // see some of my angst in http://stackoverflow.com/questions/16752242/how-does-xaml-create-the-string-to-bitmapimage-value-conversion-when-binding-to/16753488#16753488 // Note: if we discover other issues here, then we should make a more flexible solution if (propertyType == typeof(ImageSource)) return BindingMode.OneWay; return BindingMode.TwoWay; case MvxBindingMode.TwoWay: return BindingMode.TwoWay; case MvxBindingMode.OneWay: return BindingMode.OneWay; case MvxBindingMode.OneTime: return BindingMode.OneTime; case MvxBindingMode.OneWayToSource: Mvx.Warning("WinPhone doesn't support OneWayToSource"); return BindingMode.TwoWay; default: throw new ArgumentOutOfRangeException(nameof(mode)); } }
public static MvxBindingMode IfDefault(this MvxBindingMode bindingMode, MvxBindingMode modeIfDefault) { if (bindingMode == MvxBindingMode.Default) return modeIfDefault; return bindingMode; }
private MvxFullBinding TestSetupCommon(MvxBindingMode mvxBindingMode, MvxBindingMode defaultMode, out MockSourceBinding mockSource, out MockTargetBinding mockTarget) { ClearAll(); MvxBindingSingletonCache.Initialize(); var mockSourceBindingFactory = new Mock<IMvxSourceBindingFactory>(); Ioc.RegisterSingleton(mockSourceBindingFactory.Object); var mockTargetBindingFactory = new Mock<IMvxTargetBindingFactory>(); Ioc.RegisterSingleton(mockTargetBindingFactory.Object); var realSourceStepFactory = new MvxSourceStepFactory(); realSourceStepFactory.AddOrOverwrite(typeof(MvxPathSourceStepDescription), new MvxPathSourceStepFactory()); Ioc.RegisterSingleton<IMvxSourceStepFactory>(realSourceStepFactory); var sourceText = "sourceText"; var targetName = "targetName"; var source = new { Value = 1 }; var target = new { Value = 2 }; var converterParameter = new { Value = 3 }; var fallbackValue = new { Value = 4 }; IMvxValueConverter converter = null; var bindingDescription = new MvxBindingDescription { Source = new MvxPathSourceStepDescription() { Converter = converter, ConverterParameter = converterParameter, FallbackValue = fallbackValue, SourcePropertyPath = sourceText, }, Mode = mvxBindingMode, TargetName = targetName }; mockSource = new MockSourceBinding(); mockTarget = new MockTargetBinding(); mockTarget.DefaultMode = defaultMode; var localSource = mockSource; mockSourceBindingFactory .Setup(x => x.CreateBinding(It.IsAny<object>(), It.Is<string>(s => s == sourceText))) .Returns((object a, string b) => localSource); var localTarget = mockTarget; mockTargetBindingFactory .Setup(x => x.CreateBinding(It.IsAny<object>(), It.Is<string>(s => s == targetName))) .Returns((object a, string b) => localTarget); mockSource.TryGetValueResult = true; mockSource.TryGetValueValue = "TryGetValueValue"; var request = new MvxBindingRequest(source, target, bindingDescription); var toTest = new MvxFullBinding(request); return toTest; }
private MvxFullBinding TestSetupCommon(MvxBindingMode mvxBindingMode, MvxBindingMode defaultMode, out MockSourceBinding mockSource, out MockTargetBinding mockTarget) { _fixture.ClearAll(); _fixture.Ioc.RegisterSingleton <IMvxMainThreadDispatcher>(new InlineMockMainThreadDispatcher()); var mockSourceBindingFactory = new Mock <IMvxSourceBindingFactory>(); _fixture.Ioc.RegisterSingleton(mockSourceBindingFactory.Object); var mockTargetBindingFactory = new Mock <IMvxTargetBindingFactory>(); _fixture.Ioc.RegisterSingleton(mockTargetBindingFactory.Object); var realSourceStepFactory = new MvxSourceStepFactory(); realSourceStepFactory.AddOrOverwrite(typeof(MvxPathSourceStepDescription), new MvxPathSourceStepFactory()); _fixture.Ioc.RegisterSingleton <IMvxSourceStepFactory>(realSourceStepFactory); var sourceText = "sourceText"; var targetName = "targetName"; var source = new { Value = 1 }; var target = new { Value = 2 }; var converterParameter = new { Value = 3 }; var fallbackValue = new { Value = 4 }; var bindingDescription = new MvxBindingDescription { Source = new MvxPathSourceStepDescription { Converter = null, ConverterParameter = converterParameter, FallbackValue = fallbackValue, SourcePropertyPath = sourceText, }, Mode = mvxBindingMode, TargetName = targetName }; mockSource = new MockSourceBinding(); mockTarget = new MockTargetBinding { DefaultMode = defaultMode }; var localSource = mockSource; mockSourceBindingFactory .Setup(x => x.CreateBinding(It.IsAny <object>(), It.Is <string>(s => s == sourceText))) .Returns((object a, string b) => localSource); var localTarget = mockTarget; mockTargetBindingFactory .Setup(x => x.CreateBinding(It.IsAny <object>(), It.Is <string>(s => s == targetName))) .Returns((object a, string b) => localTarget); mockSource.TryGetValueResult = true; mockSource.TryGetValueValue = "TryGetValueValue"; var request = new MvxBindingRequest(source, target, bindingDescription); var toTest = new MvxFullBinding(request); return(toTest); }
private MvxFullBinding TestSetupCommon(MvxBindingMode mvxBindingMode, out MockSourceBinding mockSource, out MockTargetBinding mockTarget) { return TestSetupCommon(mvxBindingMode, MvxBindingMode.Default, out mockSource, out mockTarget); }
private MvxFullBinding TestSetupCommon(MvxBindingMode mvxBindingMode, out MockSourceBinding mockSource, out MockTargetBinding mockTarget) { return(TestSetupCommon(mvxBindingMode, MvxBindingMode.Default, out mockSource, out mockTarget)); }
public PerformSimpleTestParams( string sourcePath, string targetName, bool useInlinePath, MvxBindingMode bindingMode, bool testBindingMode, string converter, KeyValuePair<string, object> converterParameterValue, KeyValuePair<string, object> fallbackValue) { _source = sourcePath; _useInlinePath = useInlinePath; _target = targetName; _bindingMode = bindingMode; _testBindingMode = testBindingMode; _converter = converter; _converterParameterValue = converterParameterValue; _fallbackValue = fallbackValue; }
public MvxNotifyPropertyChangedTargetBinding(INotifyPropertyChanged target, PropertyInfo propertyInfo, MvxBindingMode mode = MvxBindingMode.TwoWay) : base(target) { _propertyInfo = propertyInfo; _mode = mode; }
public MvxBindingDescription(string targetName, string sourcePropertyPath, IMvxValueConverter converter, object converterParameter, object fallbackValue, MvxBindingMode mode) { this.TargetName = targetName; this.Mode = mode; this.Source = new MvxPathSourceStepDescription { SourcePropertyPath = sourcePropertyPath, Converter = converter, ConverterParameter = converterParameter, FallbackValue = fallbackValue, }; }
public MvxFluentBindingDescription <TTarget, TSource> Mode(MvxBindingMode mode) { BindingDescription.Mode = mode; return(this); }