Fixus
Fixus

Reputation: 4641

how can I change gridview item border when pointer/mouse is over

this is my GridView

        <Grid Grid.Column="1" Margin="80,0,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="50" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <TextBlock Text="aktualności" Style="{StaticResource PageSubheader}" />

            <local:VariableGridView x:Name="listView" Grid.Row="1" Margin="0,2,0,0" IsItemClickEnabled="True" ItemClick="listView_ItemClick" >
                <local:VariableGridView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Border>
                                <Image Source="Templates/LightGray.png" Stretch="UniformToFill"/>
                            </Border>
                            <StackPanel VerticalAlignment="Top" >
                                <TextBlock Text="{Binding title}" Height="30" Margin="15,0,15,0"/>
                                <TextBlock Text="{Binding short}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </local:VariableGridView.ItemTemplate>
                <local:VariableGridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VariableSizedWrapGrid ItemWidth="150" ItemHeight="150" Orientation="Vertical" Margin="0,0,80,0" MaximumRowsOrColumns="3"/>
                    </ItemsPanelTemplate>
                </local:VariableGridView.ItemsPanel>
            </local:VariableGridView>
        </Grid>

The local class (VariableGridView) is small extension for creating view like in Windows Store. It works OK. I can't do one thing. How to change border when the pointer is over the grid ITEM ? I can't find it.

Upvotes: 4

Views: 5394

Answers (1)

Faster Solutions
Faster Solutions

Reputation: 7005

The roll-over effects for a GridView are managed as part of its ItemContainerStyle.

In Visual Studio, right-click on the GridView on the left and select Edit Additional Templates, Edit Generated Item Container (ItemContainerStyle), Edit a Copy.

In the style that gets generated you'll find a VisualStateGroup called "Hover". These are the changes that take place to the container when a user is hovering over an item. At the bottom of the template you'll find the item container and the default wrapper for the grid-item (a border with checkbox).

Upvotes: 3

Related Questions