Dmytro Bondarenko
Dmytro Bondarenko

Reputation: 1022

How to remove defaul focus visual from GridViewItem, UWP-XAML

I'm writing UWP app for the Xbox using latest released public UWP SDK - v.14393.

I have some problems with styling the app - now with creating custom focus visual for GridView's GridViewItem with the template which described here https://msdn.microsoft.com/en-us/library/windows/apps/mt299136.aspx (not the 'ListViewItemExpanded')

So, the main question is - how to remove default focus visual state (red border on the screenshot) for the GridViewItem's template with the ListViewItemPresenter as a ControlTemplate.

Please refer the sample project is here - https://github.com/bondarenkod/bugs/blob/uwp-gridview-default-focus-visual/visualstatestest/visualstatestest/MainPage.xaml

visual tree of the GridViewItem

Upvotes: 0

Views: 689

Answers (1)

Jay Zuo
Jay Zuo

Reputation: 15758

The red border you've seen is not a focus visual effect but a selected visual effect. To remove this border, you can set SelectedBackground property to Transparent like

<ListViewItemPresenter SelectedBackground="Transparent" .../>

Besides this property, there are several other properties like SelectedPointerOverBackground and SelectedPressedBackground may influence the color of the border. These properties are ended with "Background", you may also need to change these properties according to your requirement.

Upvotes: 2

Related Questions