How to bind MenuItem.Header to Window/UserControl dependency property?

后端 未结 2 497
礼貌的吻别
礼貌的吻别 2021-01-06 09:30

I`m wondering how can I bind MenuItem.Header to the parent Window/UserControl dependency property? Here is a simple example:

Window1.xaml:



        
2条回答
  •  伪装坚强ぢ
    2021-01-06 10:07

    Alternative to H.B.'s solution is this attached behavior: ContextMenuServiceExtensions.DataContext Attached Property

提交回复
热议问题