uwp

UWP Databinding: How to set button command to parent DataContext inside DataTemplate

纵然是瞬间 提交于 2020-11-28 07:06:48
问题 Short explanation of need: I need to fire the command of a button inside a DataTemplate, using a method from the DataContext of the ViewModel. Short explanation of problem: The templated button command only seems to be bindable to the datacontext of the item itself. The syntax used by WPF and Windows 8.1 apps to walk up the visual tree doesn't seem to work, including ElementName and Ancestor binding. I would very much prefer not to have my button command located inside the MODEL. Side Note: