I have a Button
with an attached Command
:
<Button Command="{Binding Path=command}">
<Button.CommandParameter>
<s:String>1</s:String>
</Button.CommandParameter>
</Button>
where the command
is:
public ICommand command
{
get { return new DelegateCommand<string>((string str) => MessageBox.Show(str)); }
}
So far everything works fine. When I press the button, the MessageBox
with "1" message is shown.
But when I'm trying to pass a System.Int32
value as CommandParameter
, no message is shown:
<Button Command="{Binding Path=command}">
<Button.CommandParameter>
<s:Int32>1</s:Int32>
</Button.CommandParameter>
</Button>
public ICommand command
{
get { return new DelegateCommand<System.Int32>((System.Int32 n) => MessageBox.Show(n.ToString()));
}
What am I doing wrong?