How can I access a ListBox within a TabControl.ContentTemplate?

后端 未结 2 470
误落风尘
误落风尘 2020-12-22 00:57

In my code behind I set the MessageBoxTabControl.ItemsSource to an Observable Collection.


    

        
2条回答
  •  一生所求
    2020-12-22 01:27

    Should be this:

    TabItem relevantTabItem = howeverYouGetThisThing();
    var grid = System.Windows.Media.VisualTreeHelper.GetChild(relevantTabItem, 0);
    var listBox = (ListBox) System.Windows.Media.VisualTreeHelper.GetChild(grid, 0);
    

提交回复
热议问题