locked
Disable Hover Action on GridView RRS feed

  • Question

  • Hello,

    I'm working on a Windows 8 XAML app that has a GridView. This GridView has a single child item, which is defined in XAML. My xaml is similar to the following:

    <GridView x:Name="theGridView" Margin="0,-3,0,0" Padding="110,0,40,46"  SelectionMode="None" CanDragItems="False" CanReorderItems="False" IsItemClickEnabled="False" IsTapEnabled="False" AllowDrop="False" IsRightTapEnabled="False" ScrollViewer.IsHorizontalScrollChainingEnabled="False">
      <GridView.Items>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0">
          <StackPanel Orientation="Vertical">
            <TextBlock Text="Title 1" Style="{StaticResource SubheaderTextStyle}" />
            <Grid>
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
              </Grid.RowDefinitions>
              
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
              </Grid.ColumnDefinitions>
              
              <Border Grid.Row="0" Grid.Column="0" BorderThickness="2" BorderBrush="White" Height="150" Margin="3,0,3,3">
                <TextBlock Text="Hello"/>
              </Border>
              <Border Grid.Row="0" Grid.Column="1" BorderThickness="2" BorderBrush="White" Height="150" Margin="3,0,3,3">
                <TextBlock Text="World"/>
              </Border>
            </Grid>
          </StackPanel> 
        </StackPanel>
      </GridView.Items>
    </GridView>
    

    Whenever I move my mouse over the grid view, the content turns a semi-transparent light white. Almost like a hover indicator. I want to remove the hover indicator. I don't want any indication when someone hovers over the GridView or any of its contents. I need to use a GridView because this is actually hosted in a SemanticZoom control. Regardless, does anyone know how I can disable or remove the hover indicator? As you can see from the code above, I've tried all of the properties that I can think of.

    Thank you

    Thursday, June 7, 2012 11:51 AM

Answers

  • You'll need to edit the GridViewItem control template and turn off highlighting by removing the visual state and/or the visuals related to highlighting. Look for the "PointerOverBorder" visual part and remove it and the animations that target it. Alternatively, if you want all ListView/GridViews in your application to not have a hover then you can change the ListViewItemPointerOverBackgroundThemeBrush brush value in your App.xaml to Transparent.

    Hope this helps,
    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"
    Thursday, June 7, 2012 7:32 PM