-1

我有一个 ListView,它根据 DataTemplate 填充结果。请参阅下面的代码,我在 cpp 中引发属性更改事件以在 UI 中反映相同的 ResultText 字段。但是相同的值没有反映在 AutomationProperties.Name 中。如何更新 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>```
4

1 回答 1

0

我添加了 mode=OneWay,然后它起作用了。

AutomationProperties.Name="{x:Bind ResultText, Mode=OneWay}">
于 2021-04-09T07:51:24.920 回答