Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I bind IsEnabled property of ContextMenu in Silverlight 4?

How do I bind IsEnabled property in Silverlight 4 (XAML)?

I tried simply IsEnabled="{Binding ABC}" but this is not working - the MenuItem is always enabled.

Thanks in advance for the clues!

Cheers

Edit:

What is interesting, when setting Mode=TwoWay the bindings seem to work. However, the look of context menu is updated after moving the mouse over a menu item. Is that working asynchronously? What is the way to update the layout of my context menu just after right-clicking? (I tries UpdateLayout() but it didn't work)

like image 652
Jamie Avatar asked Mar 27 '11 00:03

Jamie


2 Answers

Okay, it is a known bug in Silverlight Toolkit - the look of context menu does not change even if IsEnabled property is bound and notified properly. I had to implement a workaround (simple updating the view of the control). Anyway, thanks for the replies :)

like image 84
Jamie Avatar answered Oct 07 '22 00:10

Jamie


A good way to debug this is to take a look at the Output Window while debugging with Visual Studio. Problems with bindings are printed there.

Have you set your DataContext to an object that has a public property ABC?

like image 40
Colin Thomsen Avatar answered Oct 07 '22 02:10

Colin Thomsen