Open SaiPasumarthy opened 5 years ago
We are using Test stack white to automate our wpf application. I'm trying to get the items in templated combobox. The combobox sytle and combobox usage given below.
Template Code:
<Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ComboBox}"> <Border x:Name="myEDVTypeComboboxBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <Grid x:Name="myEDVTypeComboboxGrid" SnapsToDevicePixels="True" IsSharedSizeScope="True" Background="{DynamicResource EDVTypeComboBoxStyle.Background}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Popup x:Name="myEDVTypeComboboxPopup" AllowsTransparency="True" IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom" Margin="1"> <Border x:Name="myEDVTypeComboboxPopupBorder" Background="{DynamicResource EDVTypeComboBoxStyle.Background}" BorderBrush="{DynamicResource EDVTypeComboBoxStyle.BorderBrush}" BorderThickness="1.1"> <ListBox x:Name="myEDVTypeListBox" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Width="{TemplateBinding ActualWidth}" ItemsSource="{TemplateBinding ItemsSource}" SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem}" Style="{StaticResource DataTypeDescriptionListBoxStyle}" /> </Border> </Popup> <ContentPresenter x:Name="myEDVComboboxContentPresenter" Grid.Column="0" IsHitTestVisible="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" /> <ToggleButton x:Name="myEDVComboboxExpanderArrowToggleButton" Grid.Column="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" Style="{StaticResource EDVTypeComboBoxReadonlyToggleButtonStyle}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" /> <ToggleButton x:Name="myEDVComboboxExpanderToggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" Style="{StaticResource EDVTypeComboBoxExpanderToggleButtonStyle}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter>
Usage :
<ComboBox x:Name="myMM_GEV_TypeComboBox" Grid.Column="1" ItemsSource="{Binding Source={StaticResource DataTypeFromEnum}}" SelectedValue="{Binding SelectedBindingGroupElement.DataType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource EDVTypeComboBoxStyle}" AutomationProperties.AutomationId="MM_GEV_TypeComboBox" />
and i'm trying to get the combobox element items by using below code:
`var aTypeComboBox = AppHandler.AppWindow.Get<ComboBox>(SearchCriteria.ByAutomationId("MM_GEV_TypeComboBox"));`
aTypeCombBox is exists but inside items are coming zero.
Any help would be appreciated.
We are using Test stack white to automate our wpf application. I'm trying to get the items in templated combobox. The combobox sytle and combobox usage given below.
Template Code:
Usage :
and i'm trying to get the combobox element items by using below code:
aTypeCombBox is exists but inside items are coming zero.
Any help would be appreciated.