Conversation
When a listbox contains items that are not of type "ListBoxItem" then scrolling causes item selection. There is an issue that demonstrates that (IssueTests/listbox.fap). The above change fixes the problem but I am not very sure if it is the right way to handle it.
|
Good find. |
|
Thanks Brad. |
|
Looks like you're checking to see if the current item is a UIElement as to whether to reuse a recycled container. This doesn't feel right. I would guess that selection problems would be in proximity to the selection code. I'm open to being proved wrong with tests. |
|
I'm struggling to put together a test that demonstrates the problem. The reason I'm checking if the current item is a UIElement before setting it to a recycled item is because the cache is only supposed to contain UIElement items. My listbox does not contain items of ListBoxItem type and this is only when the error occurs. |
|
A few lines above you are also checking for a UIElement before setting generator.Current to a UIElement. |
|
I see where you're headed. In the following, we are testing to see whether the user's "Item" is already of type The point of the following is to pull a container out of the recycled cache instead of generating a new one. We would want to do this if the current "Item" was not a |
When a listbox contains items that are not of type "ListBoxItem" then scrolling causes item selection. There is an issue that demonstrates that (IssueTests/listbox.fap). The above change fixes the problem but I am not very sure if it is the right way to handle it.