0

I'm using the following code and I wish to disable the blue mark when user hovers the list with the cursor, how can I do that?
I tried with the resources code without success.

I cannot change it to list box...(since I have the column I guess)

        <ListView x:Name="listView" ItemsSource="{Binding Dispaly}" Height="250" 
                      ScrollViewer.HorizontalScrollBarVisibility="Disabled"  FontFamily="Calibri">
            <ListView.View>
                <GridView>
                    <GridViewColumn DisplayMemberBinding="{Binding Key}" Header="{x:Static res:Resources.AB}"   Width="150" />
                    <GridViewColumn DisplayMemberBinding="{Binding Value}" Header="{x:Static res:Resources.CC}" Width="150"/>
                </GridView>
            </ListView.View>
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="BorderThickness" Value="0 0 0 1"/>
                    <Setter Property="BorderBrush" Value="AntiqueWhite"/>

                </Style>
            </ListView.ItemContainerStyle>

            <ListView.Resources>
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
                <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
            </ListView.Resources>

        </ListView>
Lee
  • 29,398
  • 28
  • 117
  • 170
Jean Tehhe
  • 1,247
  • 5
  • 19
  • 38
  • you can do this by editing the control template, http://stackoverflow.com/questions/1051215/wpf-listview-turn-off-selection – Sivakumar Feb 04 '14 at 11:09

3 Answers3

0

You can Edit ListView control template and remove IsSelected trigger from Control template.

http://msdn.microsoft.com/en-us/library/ms788717.aspx

Sivakumar
  • 478
  • 2
  • 13
0

This is example how you can edit ListViewItem control template. Insert whatever u want in button

        <ListView.Resources>
            <Style TargetType="{x:Type ListViewItem}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ListViewItem}">
                            <Button Background="Transparent" Foreground="White"  FontSize="16" FontWeight="Light">
                                <Button.Content>
                                    <GridViewRowPresenter Content="{TemplateBinding Content}" />
                                </Button.Content>
                            </Button>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ListView.Resources>

You can also try editing style of listView. Add a Trigger for property IsSelected and set Background of listviewitem in Trigger's Setter

Koscik
  • 190
  • 1
  • 3
  • 14
-1

You just need to add trigger IsMouseOver without setter for listviewitem's style.

  <ListView>
    <ListView.ItemContainerStyle>
            <Style>
               <Style.Triggers>
                  <Trigger Property="IsMouseOver" Value="True">
                  </Trigger>
               </Style.Triggers>
            </Style>
         </ListView.ItemContainerStyle>
    </ListView>
m4a
  • 187
  • 1
  • 11