Reputation: 3204
How do I debug a RoutedUICommand when the associated UIElement is disabled.
For example, consider the ContextMenu. Since it exists in a different VisualTree, a command written with the menu item might not be able to propagate from it to the parent where it has been subscribed. In such scenarios, imagine that the source code is so huge, how do I debug. Are there any tools to assist me in finding these kind of errors/mistakes.
Upvotes: 4
Views: 2230
Reputation: 785
The "Output" window of Visual Studio shows some information about data binding and commands. You can increase the output by setting the appropriate options in "Tools-Options-Debugging-Output Window-WPF Trace Settings".
Regarding the deactivated state: If "CanExecute" is not specified, it will always evaluate to "true". Check the "CanExecute" method or disable it for debugging.
Upvotes: 1
Reputation: 4329
It sounds like your CommandBinding isn't making use of a CanExecute handler. Some example XAML would be helpful here.
Upvotes: 0