Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to pass ConverterParameter to a binding, when using SetBinding in code.

$
0
0

When using ValueConverters in bindings, you can pass arguments to them from the binding like this using XAML:

(Excerpt from Xamarin tutorial)
<Label Text="{Binding Color.R, Converter={StaticResource intConverter}, ConverterParameter=255, StringFormat='R={0:X2}'}" />

I do, however, need to set a binding from code like this from code behind:
template.SetBinding(HeaderCell.ExpiresProperty, vm => vm.ExpiryDate, BindingMode.OneWay, dateTimeValueConverter);

In doing so, I am uncertain as how to pass the ConverterParameter.
Naturally, I could use properties to modify the behavior of the converter - but I would prefer to figure out how to do it properly.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>