Quick Links

Button Background color in a list not honoring binding property

I was trying to mimic a selection by using a button and binding to the background color. At first, it seemed like it worked. But the list was kind of large and when I scroll through it, I see multiple buttons that look selected, when I know their background color is wrong. Scrolling back to the top, the item that was selected, now isn't, and something else is.

I have added a 2nd button and a label and their TextColor which I set the same way as the button Background color, is dead on. I even added a Clicked event just to popup an alert and display the background color of the button clicked on, and it shows the correct color.

I have only experienced this on Android so far, I have not implemented the code I need for iOS yet to build the list, but it behaves the same in an Android emulator and on a real Android device.

Following is the xaml for the page I am testing. Any idea what is going on with the Background color on the buttons?

One side note, my emulator displays about 11.5 lines. There seems to be a pattern of 12 non-selected (white background) buttons between a single selected (kind of blue color) buttons. And this repeats through the entire list.

Answers

In code I am. I get my list. I have attached an image. If you look at the image, you will see the first item has an oval blue button while all the others have a white button. The 2nd button's text and text color, and the following label's text and text color are set to the same value as the background color of the first button.
There are 102 items in the list. If you scroll the list down, you will encounter another line where the oval button is blue. But, that is not what the background color is set too. When you scroll back up to the top, the image will look exactly like the attachment except the first lines oval button will be white and some other line will have the blue button.
So, for some reason the background color for the button gets repeated in places where it is not set to that color, and does not stay associated with the button it is actually set on.