Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
felino Absent Member.
Absent Member.
708 views

[UFT] [WPF] DataGrid: get items of ControlTemplate

Hi,
i'm testing a WPF application.

I have the source code:

<DataGrid.GroupStyle>
	<GroupStyle>
		<GroupStyle.Panel>
			<ItemsPanelTemplate>
				<DataGridRowsPresenter/>
			</ItemsPanelTemplate>
		</GroupStyle.Panel>
		<GroupStyle.ContainerStyle>
			<Style TargetType="{x:Type GroupItem}">
				<Setter Property="Margin" Value="0,0,0,5"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type GroupItem}">

							<Expander Name="GroupLot" Loaded="GroupLot_Loaded" Expanded="GroupLot_Expanded" Collapsed="GroupLot_Collapsed" BorderThickness="1,1,1,5">
								<Expander.Header>
									<Grid HorizontalAlignment="Stretch">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto"/>
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="*" />
											<ColumnDefinition Width="Auto" />
										</Grid.ColumnDefinitions>

										[...]
										
										<TextBlock Grid.Column="1" FontWeight="Bold" Margin="10,0,0,0" Width="Auto" VerticalAlignment="Center" Foreground="White">
											<Run>Description:</Run>
											<Run>
												<Run.Text>
													<MultiBinding Converter="{StaticResource TypeLot}" Mode="OneWay">
														<Binding Path="Name" />
														<Binding Path="DataContext" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}"/>
													</MultiBinding>
												</Run.Text>
											</Run>
										</TextBlock>
										
									</Grid>
								</Expander.Header>
								<Expander.Content>
									<ItemsPresenter Visibility="{Binding ElementName=GroupLot, Path=IsExpanded, Converter={StaticResource BoolToVis}}" />
								</Expander.Content>
							</Expander>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>
		</GroupStyle.ContainerStyle>
	</GroupStyle>
</DataGrid.GroupStyle>

I worte this code for get ControlTemplate:

WpfWindow("myApp").WpfTable("gridLots").Object.GroupStyle.Item(0).ContainerStyle.Setters.Item(1).Value

but, how can I get the expander and the TextBlock into it?

Thanks.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.