views:

82

answers:

1

I don't understand, I have a toolbar with buttons bind to custom commands.

Also I have an expandable control docked to the left of window - kinda NavPanel. (Devcomponents' NavigationPane to be exact)

Now, everytime when it's collapsed or expanded, buttons in the toolbar become disabled and stay like that till the focus changes.

Of course, it's simple to change the focus inside Collapsed and Expanded events, but unfortunately it works only in the first and ignores the second one and all buttons stay disabled.

It seems that it something to do with CommandTarget which I haven't define nowhere. Maybe I should? Any ideas?

+1  A: 

When the Buttons gray-out, then two conditions can exist:

  • The *MyCommand*Can_Execute method sets the e.CanEecute property to false.
  • The CommandBinding is inactive.

I think the latter case is your problem. At what level in the visual tree have you defined your CommandBindings? Put them as high up as you can.

Dabblernl