I have sending multiple parameters from my Checkbox Command. I have used a converter. The code is below. If i put a debugger and see the values here are my results :
When checkbox check is either checked or unchekcked :
In the converter it has teh values (Array of the item object and boolean). But when i come to my method, the value is a object[2] but both values are NULL
CheckBox XAML
<CheckBox x:Name="checkBox"
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.Data.Label}"
ClickMode="Release"
Command="{Binding Path=DataContext.SelectUnSelect}">
<CheckBox.CommandParameter>
<MultiBinding Converter="{StaticResource SelectedItemConverter}">
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Content.Data"/>
<Binding RelativeSource="{RelativeSource Self}" Path="IsChecked"/>
</MultiBinding>
</CheckBox.CommandParameter>
Convertor :
public class CheckConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return values;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
View Model Command Code :
public ICommand SelectUnSelect
{
get { return new RelayCommand<object>(parm => this.SelectAndUnSelect(parm));}
}
If i put a debugger in SelectAndUnSelect method, it shows me object[2] in parm but both of them are null.
Observation : If i bind my command parameter to any one of the bindings it works fine.
What am i missing here ?
- Shankar