dotnet icon indicating copy to clipboard operation
dotnet copied to clipboard

Undocumented change in RelayCommand compared to MVVM Light

Open hardcodet opened this issue 2 months ago • 0 comments

Overview

Compared to MVVM Light, RelayCommand has a major (undocumented) breaking change as it doesn't seem to integrate with CommandManager - as a result, their CanExecuteChanged event doesn't fire automatically anymore, which broke tons of functionality in our app.

In order to fix the issue, my approach would have been to subclass RelayCommand and subscribe to CommandManager, but the class is sealed. Not sure I see a reason for this - wouldn't it make sense to unseal the class? I've had use cases before where I would have appreciated that already in order to provide hooks.

API breakdown

  • If possible, update https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/migratingfrommvvmlight
  • Unseal RelayCommand implementations

hardcodet avatar Dec 11 '25 13:12 hardcodet