-
January 25th, 2010, 12:36 PM
#1
UI Commands details
MSDN says that one can create a custom command in 2 ways: either by declaring a class that implements ICommand or by "using" RoutedCommand or RouterUICommand classes (that derive from Command).
Question 1: what is the difference between those 2 approaches? MSDN says that first one gives you more flexibility, but what exactly?
Let`s use the second approach. To define a custom command I should use the following code:
public static RoutedUICommand DownloadCommand = new RoutedUICommand("Download data", "DownloadCommand", typeof(DownloadCommandWrapper), new InputGestureCollection(new InputGesture[] { new KeyGesture(Key.F2, ModifierKeys.None, "Download data") }));
That`s ok. I could call this command eg. from a button by assigning this command under 'Command' property of a button. But how could I call it from a control that does not expose such property? For example, I would like to call this command after user clicks the Image.
Thank you in advance for help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|