Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Can't find content of TabItemEx in Inspect.exe
posted

We're trying to write Automated UI tests for an application which uses TabItemEx to display its functionality, however we're not able to traverse the UI Element Tree (with Inspect.exe) into the content of a TabItemEx. The content is not visible with tools such as Inspect.exe and FlaUInspect.exe, but is visible with the Live Visual Tree is Visual Studio and Snoop.

<Custom:XamTabControl x:Name="mainTabs" IsEnabled="{Binding IsInitialized}"
                Style="{DynamicResource ApplicationTabs}" AutomationProperties.Name="mainTabs" >
            <Custom:TabItemEx x:Name="homeTab" AutomationProperties.AccessKey="homeTabAccessKey">
                <Custom:TabItemEx.Header>
                    <StackPanel Orientation="Horizontal">
                        <Viewbox Width="16" Height="16">
                            <ContentPresenter ContentTemplate="{DynamicResource Home}"></ContentPresenter>
                        </Viewbox>
                        <TextBlock Text="{local:Localize home}" FontWeight="Bold" Margin="5,0,0,0"></TextBlock>
                    </StackPanel>
                </Custom:TabItemEx.Header>
                <view:HomeControl AutomationProperties.AutomationId="homeControl" />
            </Custom:TabItemEx>
</Custom:XamTabControl>

The content we're trying to reach is the homeControl. We've discovered that, if placed inside the TabItemEx.Header tag, the homeControl becomes reachable through automated UI tests.