Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of box selection border of GridView UWP

I have this gridview which works fine, but everytime I select an item I got this blue line around the item, how to remove it ?

<GridView Margin="5,15,0,0"  x:Name="List" ItemsSource="{Binding}" SelectionChanged="List_SelectionChanged">
        <GridView.ItemTemplate>
            <DataTemplate>
                <Grid  Margin="11">
                    <StackPanel BorderBrush="Black" Orientation="Vertical">
                        <Image Width="150" Height="150" Source="{Binding Way}" />
                    </StackPanel>
                </Grid>
            </DataTemplate>
        </GridView.ItemTemplate>
        <GridView.ItemsPanel>
            <ItemsPanelTemplate>
                <ItemsWrapGrid  MaximumRowsOrColumns="2" Orientation="Horizontal" />
            </ItemsPanelTemplate>
        </GridView.ItemsPanel>
    </GridView>

enter image description here


1 Answers

The following fixed it for me:

<GridView.ItemContainerStyle>
    <Style TargetType="GridViewItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GridViewItem">
                    <ListViewItemPresenter
                SelectedBackground="Transparent"
                SelectedPointerOverBackground="Transparent"
                PressedBackground="Transparent"
                SelectedPressedBackground="Transparent"
                />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</GridView.ItemContainerStyle>
like image 84
Arjun Avatar answered Jan 03 '26 15:01

Arjun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!