XAML: ListView.IsMouseOver. Can the default row highlighting be disabled?

This posting adds a red LinearGradientBrush when ever the mouse is over a row in the ListView - the default ListView IsMouseOver highlights the row with a blue style.  Anyone know of a way to remove the IsMouseOver row highlighting effect from a plain ListView?

~ by mdavey on June 14, 2007.

3 Responses to “XAML: ListView.IsMouseOver. Can the default row highlighting be disabled?”

  1. Try just setting it back to the bound value:

  2. Here’s the encoded XAML:

    <Style x:Key=”MyContainer” TargetType=”{x:Type ListViewItem}”>
    <Style.Triggers>
    <Trigger Property=”IsMouseOver” Value=”true”>
    <Setter Property=”Foreground” Value=”{Binding Foreground}” />
    <Setter Property=”Background” Value=”{Binding Background}”/>
    </Trigger>
    </Style>

  3. You could handle the selection changed event and clear the selection:

    void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
    KListView lv=sender as KListView;
    lv.SelectedItems.Clear();
    }

Leave a Reply