开发者

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

开发者 https://www.devze.com 2023-02-19 19:38 出处:网络
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.

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 w开发者_JS百科ay to update the layout of my context menu just after right-clicking? (I tries UpdateLayout() but it didn't work)


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 :)


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消