I have a parent window (windowMain) that has a child UserControl (userOne) and another UserControl (userTwo) within userOne.
windowMain has a BarButtonItem and I need to bind that ItemClick event to a BarButtonItem ItemClick event on the Child’s Child UserControl userTwo.
As a work around I have created a hidden ToggleButton on userTwo that runs the method of the UserControl’s BarButtonItem.
From windowMain, I can easily find this hidden ToggleButton on the UserControl (using VisualTreeHelper) and run the method via the hidden ToggleButton’s IsChecked Event.
This works well, but as a new WPF programmer it seems unnecessary to have hidden buttons to do this, so here’s my first question on this site:
Is there a way to directly bind the parent BarButtonItem ItemClick event to the userTwo BarButtonItem ItemClickEvent?
While there is a ton of advice on binding but I can’t find a specific solution to this scenario from Parent to a Child’s Child.
Alan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.