Maui ListView does not reset position when new data (new ItemsSource) is added
Maui ListView after scrolling and loading of new items does not scroll to the top.
.NET MAUI
-
Rob Caplan - MSFT 5,437 Reputation points • Microsoft Employee
2022-09-28T19:11:10.663+00:00 Please post but reports and feature requests for MAUI in the MAUI GitHub repo at https://github.com/dotnet/maui .
Please include full version information, exact steps, and how the actual behavior differs from the expected or desired behavior.Don't use this site to report product bugs or feature requests
This is a site for support, so please use the right site to requests new feature requests about a Microsoft product or report any bugs. This will ensure that the experts can focus on resolving user's problems instead of having to redirect you to the right site. -
Lloyd Sheen 1,476 Reputation points
2022-09-29T15:25:33.357+00:00 Rob you keep posting this but I am asking because there may be something I am missing. I don't work for MS so I don't know what is a bug and what is something that I am doing wrong.
-
Rob Caplan - MSFT 5,437 Reputation points • Microsoft Employee
2022-09-29T18:28:41.757+00:00 If you have a question that you'd like help with then please include clear details: version, what you're doing, what behavior you're trying to achieve, how the actual behavior differs, etc. and a clear question. What you've been posting have sounded like bug reports and haven't had enough details to be actionable.
If you're just reporting bad behavior and don't need help with it then file it as a bug report in the Github repo.
That said, if you're looking for a way to clear the ListView after updating the ItemsSource updates you can set the SelectedItem properly explicitly. See Clear the selection
Clear the selection
The SelectedItem property can be cleared by setting it, or the object it binds to, to null.
-
Lloyd Sheen 1,476 Reputation points
2022-10-05T21:46:31.767+00:00 So I tried this but it did nothing.
I created a property that would bind to the selected item. When I select an item using UI the Set is called.
I then set the ItemsSource to a new list of items and set the property to NULL. The set is called (of course) but a Get on the property is not called and in the UI the list does not go to the top.
-
Rob Caplan - MSFT 5,437 Reputation points • Microsoft Employee
2022-10-06T19:17:54.987+00:00 If you need help please edit your question to include clear details on what you are doing and what you need: MAUI and target platform versions, what you're doing (minimal code snippet), what behavior you're trying to achieve, how the actual behavior differs, etc.
We can't help you if you don't provide clear and sufficient information to work on, and it is difficult if that information is hidden in irrelevant asides.
If you'd prefer to speak to somebody directly about this you can open a case at https://support.serviceshub.microsoft.com/supportforbusiness/create?sapId=27261ac1-649d-6bd3-6b8f-427ac125ade8 and choose Developer Tools / .NET / .NET 6.0 / Multi-platform App UI (.NET MAUI) / User Interface Controls
-
Lloyd Sheen 1,476 Reputation points
2022-10-06T19:27:10.21+00:00 Really simple.
- I get a list of items (doesn't matter how) so lets say 10 items. They show on a list.
- Select one of those items by clicking it and event happens and I do whatever with the selected item.
- Get another list of items lets say 15. If the item that was selected in step 2 is lets say item 8, then the new list (new items) will stay scrolled to item 8 in the new list.
Now what I want is when there is a new list that the list being displayed will start with item 1 at the top and if I need I can scroll to the item I want.
I tried setting the selected item in code and while it is selected the UI does not scroll to that item so selecting item 1 [0] does not work.
-
Rob Caplan - MSFT 5,437 Reputation points • Microsoft Employee
2022-10-12T01:44:09.727+00:00 If you need help please edit your question to include clear details on what you are doing and what you need: MAUI and target platform versions, what you're doing (minimal code snippet), what behavior you're trying to achieve, how the actual behavior differs, etc.
Guessing what you're doing and what you're running into is clearly not providing useful answers, and we need clear details before we can do more than guess.
If you'd prefer to speak to somebody directly about this you can open a case at https://support.serviceshub.microsoft.com/supportforbusiness/create?sapId=27261ac1-649d-6bd3-6b8f-427ac125ade8 and choose Developer Tools / .NET / .NET 6.0 / Multi-platform App UI (.NET MAUI) / User Interface Controls
Sign in to comment