
{"id":814,"date":"2011-02-25T22:59:32","date_gmt":"2011-02-26T03:59:32","guid":{"rendered":"http:\/\/www.ikriv.com\/blog\/?p=814"},"modified":"2011-02-25T22:59:32","modified_gmt":"2011-02-26T03:59:32","slug":"contextmenu-strikes-again-data-context-not-properly-updated","status":"publish","type":"post","link":"https:\/\/ikriv.com\/blog\/?p=814","title":{"rendered":"ContextMenu strikes again: data context not properly updated"},"content":{"rendered":"<p>Since context menu is not part of visual tree, you cannot use things like <code>ElementName<\/code> in its bindings. However, a context menu, that context menu will inherit DataContext of its parent control, <a href=\"http:\/\/drwpf.com\/blog\/2008\/05\/22\/leveraging-freezables-to-provide-an-inheritance-context-for-bindings\/\">because it is Freezable<\/a>.<\/p>\n<p>The trouble is, this inheritance works only once. If datacontext of the parent control later changes, ContextMenu will remain with the old copy. This caused me a real bug today. Argh. <a style=\"display:none\" href=\"http:\/\/www.codeproject.com\/script\/Articles\/BlogFeedList.aspx?amid=1181663\" rel=\"tag\">CodeProject<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since context menu is not part of visual tree, you cannot use things like ElementName in its bindings. However, a context menu, that context menu will inherit DataContext of its <a href=\"https:\/\/ikriv.com\/blog\/?p=814\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[12],"tags":[],"class_list":["entry","author-ikriv","post-814","post","type-post","status-publish","format-standard","category-wpf"],"_links":{"self":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=814"}],"version-history":[{"count":0,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/814\/revisions"}],"wp:attachment":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}