WPF ListView Accessability an element IsOffScreen error

Slaughenhaupt, Gary 1 Reputation point
2021-02-10T17:55:08.44+00:00

Using the sample code: https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/how-to-create-a-custom-view-mode-for-a-listview?view=netframeworkdesktop-4.8

I modified the ListView style to use a StackPanel instead of a WrapPanel to get a 1 row scrollable view.

<Style x:Key="{ComponentResourceKey
TypeInTargetAssembly={x:Type l:PlainView},
ResourceId=myPlainViewDSK}"
TargetType="{x:Type ListView}"
BasedOn="{StaticResource {x:Type ListBox}}"

<Setter Property="HorizontalContentAlignment"  
        Value="Center"/>  
<Setter Property="ItemContainerStyle"   
        Value="{Binding (ListView.View).ItemContainerStyle,  
        RelativeSource={RelativeSource Self}}"/>  
<Setter Property="ItemTemplate"   
        Value="{Binding (ListView.View).ItemTemplate,  
        RelativeSource={RelativeSource Self}}"/>  
<Setter Property="ItemsPanel">  
  <Setter.Value>  
    <ItemsPanelTemplate>  
      <StackPanel Orientation="Horizontal" Width="{Binding (FrameworkElement.ActualWidth),  
                 RelativeSource={RelativeSource   
                                 AncestorType=ScrollContentPresenter}}"  
                 />  
    </ItemsPanelTemplate>  
  </Setter.Value>  
</Setter>  

</Style>
Whith this change I get and error from the Accessibility Insights tool. An element's IsOffScreen Property must be false when its clickable point is on screen.

How do I get this same behavior without getting this error?
66579-horizontallistview.png

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,710 questions
{count} votes