fernandreu / office-ribbonx-editor

An overhauled fork of the original Custom UI Editor for Microsoft Office, built with WPF
MIT License
516 stars 100 forks source link

Add source generation for commands #146

Closed fernandreu closed 3 years ago

fernandreu commented 3 years ago

Instead of having to type the boilerplate of;

private RelayCommand? _insertIconsCommand;
public RelayCommand InsertIconsCommand => _insertIconsCommand ??= new RelayCommand(ExecuteInsertIconsCommand);

use an attribute for the method that does this for you:

[GenerateCommand]
private void ExecuteInsertIconsCommand()
{
    ...
}

This should be 100% feasible with source generators. These should also: