How to get text from a hyperlink in a grid

Aug 5, 2010 at 9:57 AM
Edited Aug 5, 2010 at 9:59 AM

This is how a column of the grid is described in XAML:

<xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName="AssumptionBaseline.ElementName" Title="Element" Width="200" ShowInColumnChooser="False"
                 IsMainColumn="True" VisiblePosition="0" >
        <xcdg:Column.CellContentTemplate>
            <DataTemplate>
                <TextBlock HorizontalAlignment="Left"
                           VerticalAlignment="Center"
                           AutomationProperties.AutomationId="ElementNameText1">
                        <Hyperlink Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type MVP:View}}, Path=DataContext.OpenDatapackCommand}"
                                   AutomationProperties.AutomationId="AssumptionBaselineElementName"
                                   CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:DataRow}}, Path=DataContext.AssumptionBaseline.Element}">
                            <TextBlock Text="{Binding}"
                                       AutomationProperties.AutomationId="ElementNameText2"/>
                        </Hyperlink>
                    </TextBlock>
            </DataTemplate>
        </xcdg:Column.CellContentTemplate>
    </xcdg:Column>
...

The following code does not return any controls:

            assumptionBaselineListControl.Rows[0].Select();

           var M = assumptionBaselineListControl.Get(SearchCriteria.ByAutomationId("ElementNameText1"));

            var N = assumptionBaselineListControl.Get(SearchCriteria.ByAutomationId("ElementNameText2"));

This one does return the HyperLink:

 

             var O = assumptionBaselineListControl.Get(SearchCriteria.ByAutomationId("AssumptionBaselineElementName"));

but it I can't see the text in it.

That one:

              var G = assumptionBaselineListControl.GetMultiple(SearchCriteria.All);

returns aplenty, I can see the same hyperlink as in O and many other controls, including apparently generated one with AutomationID = Cell_AssumptionBaseline.ElementName (could not spot my text data there), but

                var L = assumptionBaselineListControl.Get(SearchCriteria.ByAutomationId("Cell_AssumptionBaseline.ElementName"));

 again returns nothing.

I would appreciate your help, thanks.

 

 Valery