1. Converterparameter is not a dependency property, so the binding cannot be used.
2. The converter interface IValueConverter can be changed to Imultivalueconverter to achieve multipleMultiBinding
3. Imultivalueconverter code, for example:
Public classMultibooltocolorconverter:imultivalueconverter { Public ObjectConvert (Object[] values, Type targetType,Objectparameter, System.Globalization.CultureInfo culture) { varcolor = SYSTEM.WINDOWS.MEDIA.COLOR.FROMRGB (0x31,0x89,0xC6);//"#3189c6"; if(values.) All (v = (v is BOOL&& (BOOL) (v)) | | Values. All (v = (v is BOOL&& (BOOL) v==false)) {color= SYSTEM.WINDOWS.MEDIA.COLOR.FROMRGB (0x89,0xBB,0xE0);//"#89BBE0"; } return NewSystem.Windows.Media.SolidColorBrush (color); } Public Object[] Convertback (ObjectValue, type[] targettypes,Objectparameter, System.Globalization.CultureInfo culture) { Throw NewNotSupportedException (); } }
4.xmal file notation, for example:
<UserControl.Resources> <cv:multibooltocolorconverter x:key="mutiboolconverter "/> </UserControl.Resources>
<style targettype="FrameworkElement"> <setter property="Visibility"> <Setter.Value> <multibinding converter="{StaticResource Accessleveltovisibilityconverter}"> <binding path="Tag"Relativesource="{RelativeSource Mode=findancestor,Ancestortype=usercontrol}"/><binding path="Tag"Relativesource="{RelativeSource Mode=self}"/> </MultiBinding> </Setter.Value> </Setter></Style>
OR
<button content="Test"> <Button.Background> <multibinding converter="{StaticResource mutiboolconverter}"> <binding path=" isenablecredentialsadded "/> <binding path="isold"/> </multibinding > </Button.Background> </Button>
WPF Converter Converterparameter binding multi-parameter