When I use the following code it works because I am using a ListBox
<UserControl.Resources>
    <Style BasedOn="{StaticResource {x:Type ListBox}}" TargetType="{x:Type ListBox}">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Background" Value="Transparent" />
    </Style>
</UserControl.Resources>
But when I use the following code to a ListView I get an warning/exception
<UserControl.Resources>
    <Style BasedOn="{StaticResource {x:Type ListView}}" TargetType="{x:Type ListView}">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Background" Value="Transparent" />
    </Style>
</UserControl.Resources>
"StaticResource reference 'System.Windows.Controls.ListView' was not found."
Why and how to solve it? I want the functionality of a ListView.
Try this one:
<Style BasedOn="{StaticResource {x:Type ListBox}}" TargetType="{x:Type ListView}">
                        A ListView does not handle presentation, it delegates this to its View property, which is usually a GridView. Try setting the style using the GridView type as key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With