I have a TabControl with several TabItems , which separated the content in UserControls to organize the code. But all of them have a common TextBox of which I want to get the value in a Button in the MainWindow .
I'm new to WPF , I'm still learning, I thought about exposing the TextBox value in a public property on each UserControl , hence then get the TabItem selected ( (TabItem)TabControlMain.SelectedItem
), and get the internal UserControl object to access such property (could use an interface with a Get method). The problem is that I can not get this UserControl , I do not know how to do it.
I'd like to know how to do something like this, or if this is an unsuitable solution to WPF , I'd like to know how I could structure my code for such a case: in> and get internal values from the window that has TabControl , preferably separating by files (as with UserControls ).