开发者

WPF command/click argument

So I have a background in ASP.NET where a button could have a click handler or a command handler and then a command argument.

That pa开发者_如何学运维ttern was great for when you had a bunch of buttons that basically needed to execute the same block of code with only a slightly different argument.

Is there a collary in WPF?

From what I've seen of the Command in WPF is that it revolves around an action that is independent of the control that invokes it (and still doesn't provide a way to provide an argument). Which is not really what I need.


Looks like you found the Command property, but not the CommandParameter property?

Here is a tutorial for CommandBindings via RoutedEvents. Using this method you can get access to the control that raised the event, the parameter, etc.

Or if using a custom implementation of ICommand, the parameter is passed into the Execute method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜