Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF ListView : Header styling

I want to have a ListView with columns and a particular style:

The background for ALL column headers should be transparent except when the mouse is over in one of them.

When this happends, the column's background in which the mouse is over should be yellow and all the color in the other columns should be, let's say, blue.

I've tried playing with GridViewColumnHeader template, but that seems to change only the active column background. Any help?

like image 816
federubin Avatar asked Sep 24 '26 02:09

federubin


1 Answers

In order to do this, I think you're going to have to replace the entire ListView style. Microsoft has an example.

You'll have to put a Border around the GridViewHeaderRowPresenter in the ScrollViewer style shown in there and add an IsMouseOver trigger to set the background of that Border to Blue.

Then, of course, you'll need an IsMouseOver trigger on the GridViewColumnHeader template to make the background yellow.

If you need any further explanation, please ask.

-- HTH, Dusty

like image 172
dustyburwell Avatar answered Sep 26 '26 15:09

dustyburwell



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!