...
Info |
---|
iOS not yet documented |
Binding properties with a converter
Converters are a well-known topic in MVVM. Catel supports the use of converters in the binding system. The example below will convert an integer (vm.Counter) to a string with a format to "{0} clicks!". The converter will automatically be instantiated using theĀ TypeFactory. Note that using converters in Catel support both TwoWay bindings and ConverterHelper.UnsetValue to prevent any changes in the binding system.
Android
Code Block |
---|
protected override void AddBindings(BindingContext bindingContext, IViewModel viewModel)
{
var vm = (MainViewModel) viewModel;
bindingContext.AddBindingWithConverter<ClicksConverter>(() => vm.Counter, () => _testButton.Text, BindingMode.OneWay);
} |
iOS
Info |
---|
iOS not yet documented |