Forum Xamarin.Forms

UWP ONLY: How Change Default Background Color On a ListView Item Click/Tap (Selection Animation)?

It's going to be a little tricky explaining this, but stick with me, folks! :) I have a ListView that I'm wanting to customize in a UWP version of a Xamarin Forms application (this is not a problem with my Android or iOS versions; neither of them displays the following behaviors). It seems that when an item in the ListView is clicked/tapped (and then held down momentarily), it reveals a default blue background that fills the view area. I want to change that background to Color.Gold but haven't been able to find any reliable way to make that happen.

My first thought was maybe a VisualStateManager could be used, but I didn't find anything to support my particular situation. I'm wanting to change the color on a click/tap animation for the "outer" view cell while the animation is happening and after it has ended. I am not concerned with any subview controls that are in that same view cell. (Right now such subview controls are inside a Frame and they're not giving me any problems.)

Here's an illustration of what I'm talking about:

The above happens pretty quickly, of course - I've attempted to slow it down here.

I don't think the solution requires a CustomRenderer; it seems that would be overkill for something so simple in theory. But I've searched my entire project for occurrences of the string "Blue" and I didn't see any that were associated with the ListView control.

Each of my view cells contains a styled Frame object (hence the gray rounded rectangles you see in the screen shots above). But I'm hoping there's a way to change those blue flashes to gold ones.

Does anyone at Xamarin have any suggestions for an approach to this? Thanks!!!

Best Answer


Sign In or Register to comment.