WPF/C#: in desperate need of macros

As I mensioned earlier on Microsoft forums (with no response), we desperately need some kind of macro language. I am now developing some GUI using WPF. WPF is a very structured system, but look how many thigns I need to do to route a simple command:

1. In my view model class I add
private DelegateCommand<object> _groupDeleteCommand;
public DelegateCommand<object> GroupDeleteCommand
{ get { return _groupDeleteCommand; } }

2. Then in the constructor of said class I need to add
_groupDeleteCommand = new DelegateCommand<object>(OnGroupDelete);

3. Then in the body of the class I need to add
private void OnGroupDelete(object arg)

4. Then in the XAML file I need to add
<MenuItem Command="{Binding GroupDeleteCommand}" />

Rinse and repeat for every command in the command list. This is a lot of duplication. Truckloads of it. I am so annoyed, I took time to write this blog post.

Leave a Reply

Your email address will not be published. Required fields are marked *