Button in TabControl, can't find it

Feb 18, 2010 at 12:15 PM
Edited Feb 18, 2010 at 12:19 PM

Hi, i have simple app with TabControl and two buttons inside it.

This is the WPF code:

<Window x:Class="SimpleAPP.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <Style x:Key="CardTabControl"
               TargetType="{x:Type TabControl}">
           
            <Setter Property="BorderBrush"
                    Value="Black" />
            <Setter Property="BorderThickness"
                    Value="0.9" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabControl}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <TabPanel Margin="4,0,0,-1"
                                      Panel.ZIndex="1"
                                      IsItemsHost="True"
                                      VerticalAlignment="Bottom" />
                            <Button x:Name="addBtn"
                                    AutomationProperties.AutomationId="addBtn"
                                    Grid.Column="1"
                                    Width="20"
                                    Height="20"
                                   Click="addBtn_Click">
                                Card
                            </Button>
                            <Button x:Name="addFingerPrintButton"
                                    AutomationProperties.AutomationId="addFingerPrintButton"
                                    Grid.Column="2"
                                    Width="20"
                                    Height="20"
                                   Click="addFingerPrintButton_Click">
                                Finger/>
                            </Button>
                            <Border Grid.Row="1"
                                    Grid.ColumnSpan="3"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="4">
                                <Grid>
                                    <Label Name="NoCardLabel"
                                           Margin="2"
                                           Visibility="Collapsed"
                                           Content="No cards" />
                                    <ContentPresenter x:Name="PART_SelectedContentHost"
                                                      Margin="4"
                                                      ContentSource="SelectedContent" />
                                </Grid>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="SelectedIndex"
                                     Value="-1">
                                <Setter TargetName="NoCardLabel"
                                        Property="Visibility"
                                        Value="Visible" />
                            </Trigger>
                            <Trigger Property="SelectedIndex"
                                     Value="0">
                                <Setter TargetName="NoCardLabel"
                                        Property="Visibility"
                                        Value="Collapsed" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <TabControl x:Name="tabControl" Style="{StaticResource CardTabControl}"
                    AutomationProperties.AutomationId="tab"/>
    </Grid>
</Window>

---------------------------------------------------------------------------------------------------------------------------------

LogStructure(); shows:

 

System.Windows.Automation.WindowPattern
System.Windows.Automation.TransformPattern

    AutomationId: TitleBar
    ControlType: ControlType.TitleBar
    Name: Window1
    HelpText:
    Bounding rectangle: 108;108;284;22
    ClassName:
    IsOffScreen: False
    FrameworkId: Win32
    ProcessId: 1728


        AutomationId: SystemMenuBar
        ControlType: ControlType.MenuBar
        Name: System Menu Bar
        HelpText:
        Bounding rectangle: 108;108;21;21
        ClassName:
        IsOffScreen: False
        FrameworkId: Win32
        ProcessId: 1728


            AutomationId: Item 1
            ControlType: ControlType.MenuItem
            Name: System
            HelpText:
            Bounding rectangle: 108;108;21;21
            ClassName:
            IsOffScreen: False
            FrameworkId: Win32
            ProcessId: 1728

            System.Windows.Automation.ExpandCollapsePattern

        AutomationId: Minimize
        ControlType: ControlType.Button
        Name: Minimize
        HelpText:
        Bounding rectangle: 289;101;29;20
        ClassName:
        IsOffScreen: False
        FrameworkId: Win32
        ProcessId: 1728

        System.Windows.Automation.InvokePattern

        AutomationId: Maximize
        ControlType: ControlType.Button
        Name: Maximize
        HelpText:
        Bounding rectangle: 318;101;27;20
        ClassName:
        IsOffScreen: False
        FrameworkId: Win32
        ProcessId: 1728

        System.Windows.Automation.InvokePattern

        AutomationId: Close
        ControlType: ControlType.Button
        Name: Close
        HelpText:
        Bounding rectangle: 345;101;49;20
        ClassName:
        IsOffScreen: False
        FrameworkId: Win32
        ProcessId: 1728

        System.Windows.Automation.InvokePattern

    AutomationId: tab
    ControlType: ControlType.Tab
    Name:
    HelpText:
    Bounding rectangle: 108;130;284;262
    ClassName: TabControl
    IsOffScreen: False
    FrameworkId: WPF
    ProcessId: 1728

    System.Windows.Automation.SelectionPattern


 

how can i find these buttons? with custom UIItem?

i also can't find button in editable comboBox, that button appears when something is entered in editable comboBox.

i have tried uispy, white recorder...

Feb 18, 2010 at 12:53 PM

http://blogs.msdn.com/patrickdanino/archive/2009/11/11/custom-controls-and-ui-automation.aspx