Narrator is skipping my ItemsControl in the below XAML.I can swipe to the ReviewsButton, but subsequent swipe skips over all the items in the itemscontrol. Tapping on the itemscontrol results in Narrator saying nothing.
I have overridden PrepareContainerForItemOverride and can trace into it to see that it is triggering and setting the name for all items in the control. But, Narrator still fails for this control.
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Style="{StaticResource ReviewsButtonWithArrowAndCountStyle}" Click="ReviewHeader_Click"
Visibility="{Binding AppState.IsNetworkConnected, Converter={StaticResource BooleanToVisibilityConverter}}" x:Uid="ReviewsButton" TabIndex="7"/>
<controls:AccessibleItemsControl x:Name="_reviewItems" Margin="20,0,0,0" Grid.Row="1"
ItemsSource="{Binding Reviews}" Visibility="{Binding AppState.IsNetworkConnected, Converter={StaticResource BooleanToVisibilityConverter}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding
Review}" MaxHeight="50" TextTrimming="WordEllipsis" TextWrapping="Wrap" Foreground="#231F20" FontFamily="{StaticResource MundoSans}" FontSize="14.67" LineHeight="25" Margin="0,0,0,25"
/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</controls:AccessibleItemsControl>
</Grid>
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
base.PrepareContainerForItemOverride(element, item);
if (item is ICustomerReview)
{
ICustomerReview review = item as ICustomerReview;
AutomationProperties.SetName(element, string.Format(App.Strings.GetString("ProductDetail_RatingAndReview"), review.Rating, review.Name, review.DateReviewed,
review.Title, review.Review));
}
}
I overrode OnCreateAutomationPeer and created a new class AccessibleItemsControlAutomationPeer, derived from ItemsControlAutomationPeer... AccessibleItemsControlAutomationPeer.IsContentElementCore never gets called.
protected override Windows.UI.Xaml.Automation.Peers.AutomationPeer OnCreateAutomationPeer()
{
return new AccessibleItemsControlAutomationPeer(this);
}