Cant get a control from a TabControl DataTemplate
I've been googling this for the last 2 days and cant get anywhere, I just cant do anything to any control in a datatemplate of a tabcontrol. First off, the code: private void Window_Loaded(object sender, RoutedEventArgs e) { tabControl1.ItemsSource = new string[] { "TabA", "TabB", "TabC" }; } private void tabControl1_SelectionChanged(object sender, SelectionChangedEventArgs e) { ContentPresenter cp = tabControl1.Template.FindName("PART_SelectedContentHost", tabControl1) as ContentPresenter; DataTemplate dt = tabControl1.ContentTemplate; Grid g = tabControl1.ContentTemplate.FindName("myGrid",