Context Menu Data (21K): Visual Studio 2010 solution I created a simple sample that illustrates the problem.
This happens because the menu gets first created on right click and then acquires the (correct) data context from the parent.
On subsequent right clicks the same menu object is reused (as proved by the "Same menu?
" command), and its data context never changes, unless we create an explicit binding for it.
Here are some key pieces of code (certain details, including "Same menu" command were omitted for clarity): Default mechanism for data context binding works well in most cases, because most views never change data context during their lives. The most annoying issue is that even if the data context changes, everything will work right the first time the menu is invoked.
parent) data context, which continues to work even after parent's data context is changed.
You need this spell only if you expect parent's data context to change during the life of the parent.However, stale data will be returned for subsequent invocations. Observable Collection is one of the most useful classes in WPF and Silverlight data binding.Whenever you modify the collection, the view is notified. These are some of the mistakes I see from beginners and experts alike.The good control shows correct language of the selected country.The bad control shows correct language when the menu is first invoked, and then keeps showing that language even if selected country changes.