Skip to main content

ContextMenu disabled at first?

ContextMenu has an issue that results in the menu being initially disabled. Regardless of whether what they are bound to is set to enabled or disabled. This will be true until a valid left click is done, usually on a button or the content it self. The root cause is that the ContextMenu is on a separate visual and logical tree than the window. This results in the items being disabled initially until a click is made first (not right click, but left click).

Adding the following in the XAML to the menu item will resolve this issue:

1
<MenuItem Head... CommandTarget="{Binding Path=PlacementTarget, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />

Comments

Popular posts from this blog

Connecting VS 2008 to TFS?

Trouble connecting vs 2008 to TFS? If you are running a newer version of TFS, 2008 does not understand collections. In order to fix that, you need the following installed: SP1 http://www.microsoft.com/en-us/download/details.aspx?id=13276 Team Explorer http://www.microsoft.com/en-us/download/details.aspx?id=16338 Forwards Compatibility https://www.microsoft.com/en-us/download/details.aspx?id=10834

File menu opening on wrong side? [Windows 10]

If you are using windows 10 and the file menu opens on the left side, here is a fix: Run (Win+R) paste the following: shell:::{80F3F1D5-FECA-45F3-BC32-752C152E456E} click "Other" tab choose "Left-handed" Now the menu should open within the window:

Visual Studio stuck during install?

Let me start by saying this is a weird one. If you are installing VS and you notice that progress bar just isn't moving. Chances are it is stuck on something internally, to kick it out of this state, we "threaten" visual studio by initiating a windows shut down. This will result in windows prompting you to make sure you want to follow through. You can cancel out of the shutdown, and it should release visual studio from the stuck progress bar or what ever perpetual task it was stuck on.