如何从Button
在WPF
发送多个参数?我能够正确地发送值为TextBox
的单个参数。这是代码。多个命令参数wpf按钮对象
XAML
<TextBox Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="133,22,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" />
<Button Content="Button" Grid.Row="1" Height="23" Command="{Binding Path=CommandClick}" CommandParameter="{Binding Text,ElementName=textBox1}" HorizontalAlignment="Left" Margin="133,62,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
Code behind
public ICommand CommandClick { get; set; }
this.CommandClick = new DelegateCommand<object>(AddAccount);
private void AddAccount(object obj)
{
//custom logic
}
如果您描述了您想要的确切参数,它们的类型以及原因,我们可能会提供帮助。命令参数只有一个“绑定”,但根据您的需要还有其他选项,请更多信息。 – 2013-04-11 15:30:25
例如,您可以使用对象[](对象数组)对一个参数进行多个参数转换,但您需要将所有这些参数向后转换。或者有问题吗? – Master117 2013-04-11 15:38:48
嗨J国王,它会另一个控制。一个文本框可以是很好的假设。 – 2013-04-11 16:19:24