WPF - RoutedCommand vs.RoutedUICommand


If you have done any work with commands in WPF you would have come across both of the RoutedCommand class and its descendent RoutedUICommand. Also, you might have wondered, as I have, what the difference between them is and when you should use which.

What RoutedUICommand brings to the party is the Text property. This property allows HeaderedItemsControl descendents, such as MenuItem, to use this property as the content value for their Header property. Therefore if you intend use your command for a menu, a tab or any headered item use RoutedUICommand; otherwise use RoutedCommand.

No comments: