In general, for a long time I wandered across the expanses of (mostly English-speaking) Internet, I did not find an answer. How do I remove the standard selection from the ListView ?

<Style TargetType="ListView"> <Setter Property="BorderThickness" Value="0"/> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> <Setter Property="Background" Value="#FFFFFF"></Setter> <Setter Property="BorderThickness" Value="0"></Setter> <Setter Property="ItemTemplate"> <Setter.Value> <DataTemplate> <Grid Background="White"> <ContentPresenter Content="{Binding}"/> </Grid> </DataTemplate> </Setter.Value> </Setter> <Setter Property="ItemContainerStyle"> <Setter.Value> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="SnapsToDevicePixels" Value="True"/> <Setter Property="Padding" Value="2,0,0,0"/> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="TextElement.Foreground" Value="{StaticResource Brush1}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <Border BorderBrush="Transparent" BorderThickness="0" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"> <ContentPresenter HorizontalAlignment="Left" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="Auto" Margin="0" Content="{TemplateBinding Content}"/> </Border> <ControlTemplate.Triggers> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsMouseOver" Value="True"/> </MultiTrigger.Conditions> <Setter Property="Background" Value="#F5F5F5"/> </MultiTrigger> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="Selector.IsSelectionActive" Value="False"/> <Condition Property="IsSelected" Value="True"/> </MultiTrigger.Conditions> <Setter Property="Background" Value="Transparent"/> </MultiTrigger> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="Selector.IsSelectionActive" Value="True"/> <Condition Property="IsSelected" Value="True"/> </MultiTrigger.Conditions> <Setter Property="Background" Value="#A0A0A0"/> </MultiTrigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </Setter.Value> </Setter> <Style.Resources> <Style TargetType="ListBoxItem"> <Style.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black"/> </Style.Resources> </Style> <Style TargetType="GridViewColumnHeader"> <Setter Property="Visibility" Value="Collapsed" /> </Style> </Style.Resources> </Style> 

It turns out such a thing:

Someone can explain to me:

  1. Why is text in elements blue? How to change it?
  2. How to remove this blue rectangle? (I have not registered it anywhere)

PS: Brush1 - gray brush

PSS: This is my first question on the site. Sorry if something is wrong

    0