accessibilityuwp-xamlnarrator

UWP - automationProperties.Name in case of a change in value


I have a ListView which is populating the result based on DataTemplate. See the code below I am raising property changed event in cpp to reflect the same in UI for ResultText field. But the same value is not getting reflected in AutomationProperties.Name. How to update AutomationProperties.Name ?

                    <DataTemplate x:DataType="local:testResults">
                        <Grid x:Name="diagGrid" HorizontalAlignment="Stretch" Visibility="{x:Bind ShowStage, Mode=OneWay}" AutomationProperties.Name="{x:Bind ResultText}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <SymbolIcon Grid.Column="0" Symbol="{x:Bind ResultSymbol, Mode=OneWay}" Foreground="{x:Bind SymbolColor, Mode=OneWay}" Visibility="{x:Bind IsStageComplete, Mode=OneWay}" HorizontalAlignment="Center"/>
                            <ProgressRing Grid.Column="0" IsActive="{x:Bind IsStageRunning, Mode=OneWay}" Margin="10,0,20,0" HorizontalAlignment="Center"/>

                            <TextBlock Grid.Column="1" Text="{x:Bind StageName, Mode=OneWay}" Foreground="{ThemeResource AppBarItemDisabledForegroundThemeBrush}">
                            </TextBlock>
                            <TextBlock x:Name="test" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" Text="{x:Bind ResultText, Mode=OneWay}" Margin="10" TextWrapping="Wrap"/>
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>```

Solution

  • I added mode=OneWay, then it worked.

    AutomationProperties.Name="{x:Bind ResultText, Mode=OneWay}">