Как я могу перебирать элементы управления на TabItem
?
Почему-то я не могу найти контрольную коллекцию TabItem
.
Что мне не хватает?
Как я могу перебирать элементы управления на TabItem
?
Почему-то я не могу найти контрольную коллекцию TabItem
.
Что мне не хватает?
Пример из MSDN:
// Enumerate all the descendants of the visual object.
static public void EnumVisual(Visual myVisual)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(myVisual); i++)
{
// Retrieve child visual at specified index value.
Visual childVisual = (Visual)VisualTreeHelper.GetChild(myVisual, i);
// Do processing of the child visual object.
// Enumerate children of the child visual object.
EnumVisual(childVisual);
}
}
TabItem содержит один элемент управления в свойстве Content.
если вы имеете в виду цикл в TabItem TabControl :
public MainWindow()
{
InitializeComponent();
DispatcherTimer timer = new DispatcherTimer(DispatcherPriority.Background, Dispatcher);
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
private int _selectedItem = 0;
void timer_Tick(object sender, EventArgs e)
{
tabControl.SelectedItem = tabControl.Items[_selectedItem];
_selectedItem = (_selectedItem + 1) % tabControl.Items.Count;
}