Examination of the already loaded and displayed TabControl with three tabs, while the selected tab is index 1 (medium):
Tab 1: has one text block
Tab 2: has two text blocks
Tab 3: has three text fields
If I iterate over the selectedItem visual tree using VisualTreeHelper, I get two text fields in the children of the TabControl.
I want to iterate again when the tab changes and access to new tab controls. If I switch to tab index 2, I have to find three text fields using VisualTreeHelper.
The usual solution would be to subscribe to the event with the changed choice and go through the tree to get new displayed controls. The problem is that at this point in time, the visual tree still has an old tab, which makes this search useless.
How can I seize the moment when a new TabItem is displayed and start my search?
I am creating a dynamic validation mechanism that controls all the input controls of this user interface, even if it is changed either by changing the ContentControl template or using the selected TabControl tab ... I hope you get an image.
Any ideas?
source
share