Change border color on selected GridViewItem and ListViewItem

I have had this issue where any GridView or ListView I create with item selection enabled has a standard border color that I just couldn’t seem to change. It was a purple color, and it annoyed me because it didn’t match the colors I was using in my app.

I had given up hope on finding this until recently. Today I found the code for a GridViewItem style, and found the specific items that I could change a couple properties, and voilà!

Screenshot (1)

Custom color selection borders!

So here’s how you do it. First, you get the code for a GridViewItem. (Or a ListViewItem)


There are two things you are looking for (They’ll be near the bottom of each style):

  1. A rectangle with the name “SelectedBorder”
  2. A path with the name “SelectedEarmark”

All you need to do is change the Stroke property on the rectangle and the fill property on the path to the SolidColorBrush of your choice.

I hope this helps you as you seek to perfect your app!

Remember, the best way to learn is to DO. So feel free to mess around with the style code and get things looking just the way you want.



%d bloggers like this: