문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

It sounds like your CommandBinding isn't making use of a CanExecute handler. Some example XAML would be helpful here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top