Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/c327781/sibertec.com/index.php:1) in drupal_send_headers() (line 1485 of /hsphere/local/home/c327781/sibertec.com/includes/bootstrap.inc).
  • Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/c327781/sibertec.com/index.php:1) in drupal_send_headers() (line 1485 of /hsphere/local/home/c327781/sibertec.com/includes/bootstrap.inc).
  • Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/c327781/sibertec.com/index.php:1) in drupal_send_headers() (line 1485 of /hsphere/local/home/c327781/sibertec.com/includes/bootstrap.inc).
  • Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/c327781/sibertec.com/index.php:1) in drupal_send_headers() (line 1485 of /hsphere/local/home/c327781/sibertec.com/includes/bootstrap.inc).
  • Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/c327781/sibertec.com/index.php:1) in drupal_send_headers() (line 1485 of /hsphere/local/home/c327781/sibertec.com/includes/bootstrap.inc).
  • Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/c327781/sibertec.com/index.php:1) in drupal_send_headers() (line 1485 of /hsphere/local/home/c327781/sibertec.com/includes/bootstrap.inc).

A Fix for the WPF MenuItem Disabled Problem

I just recently started using the WPF with .Net.  It is amazingly similar to the GTK that I have used on Python projects.

I encountered an issue when I started using menus; sometimes the menu items are disabled when they shouldn't be, especially after returning from a modal dialog.  Clicking on a blank space on the form mysteriously reenabled them.  Multiple Google sessions and even some time spent on the Microsoft web site didn't yield any positive results.  I followed all of the advice concerning Commands and CommandBindings but there was no change in the behavior of the menus.  

Part of the problem may have been that I needed to use RoutedCommands rather than Commands.  Regardless, nothing I tried had an effect.  Then something I read gave me a crazy idea:  what if I add the CommandBinding object to the menu itself also?  I was expecting an error saying that the CommandBinding object could only be added to one object, but there was no error, and IT WORKED!

So, for those of you still searching for a solution to the disabled menu item problem, this is what worked for me:


' command and bindings
Dim cmd As RoutedCommand = New RoutedCommand()

Dim bnd As CommandBinding = New CommandBinding(cmd, _
                              AddressOf menuItem_Click, _
                              AddressOf canExecuteCustomCommand)

Me.CommandBindings.Add(bnd)

' menu
mnu = New Menu(Me)

' add menu items here
. . .

' add the binding to the menu object also
mnu.CommandBindings.Add(bnd)

I hope this will help someone else who has been frustrated by this issue.