SfListView scrolling does not work correctly in UWP when adding items at runtime. I have prepared an example, there are two objects "Block" and "Button" a block can have several buttons, so I have a SfListView with the source of blocks and inside I have another nested with the source of buttons, each block and each button have its own height, the SfListView of the block has the same height as the total height of all the buttons. This example works perfectly on Android but in UWP it has problems rendering the elements correctly at runtime the scroll works badly, I have prepared two videos to show how it works on both platforms:
Android (It works well):
https://www.youtube.com/watch?v=zvewGpWUV6Y
UWP (The scroll works badly):
https://www.youtube.com/watch?v=HEKlG1GcH8w
I have posted the example on GitHub:
Note: To create buttons at runtime you must have a block selected.
|
public ExtendedListView()
{
if (Device.RuntimePlatform == Device.UWP)
{
this.container = this.GetVisualContainer();
this.DataSource.SourceCollectionChanged += DataSource_SourceCollectionChanged;
}
}
private void DataSource_SourceCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
Device.BeginInvokeOnMainThread(async () =>
{
var totalextent = (double)container.GetType().GetRuntimeProperties().FirstOrDefault(container => container.Name == "TotalExtent").GetValue(container);
this.HeightRequest = totalextent;
});
} |
Hi, first of all thanks, it works as expected. But I have found a strange behavior, when you select a button with the scroll down there is a flicker that makes you lose focus on the selected element and the scroll goes up this happens only in UWP, I attach a video to see what I say:
Testing more deeply I have found another problem, when you update the height of an element of the DataTemplate at runtime the SFListview does not update its height so the elements are choppy.
I have prepared a video showing the problem alongside a Github repository:
Video:
https://www.youtube.com/watch?v=bM9_819Ftd8
GitHub sample:
|
…
this.container.PropertyChanged += Container_PropertyChanged;
…
private void Container_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
Device.BeginInvokeOnMainThread(async () =>
{
var extent = (double)container.GetType().GetRuntimeProperties().FirstOrDefault(container => container.Name == "TotalExtent").GetValue(container);
if (e.PropertyName == "Height")
this.HeightRequest = extent;
});
}
|
Hi, thanks for the work done. But I have found another problem that causes a crash, when you create multiple blocks at runtime and try to scroll the application crashes. It only happens when the ExtendedListView nested list has the IsScrollingEnabled property set to 'False', when it is set to 'True' it doesn't happen but the height of the lists look bad, I include a video along with an example on GitHub:
In the video I only show how to reproduce the crash, the error is not seen because I only record the UWP application, below I will include a photo of the error in the visual studio:
https://www.youtube.com/watch?v=tkxZ1HVkG10
Image from error:
GitHub sample:
Thanks for everything. I also found another bug related to updating the element height of the SfListView runtime DataTemplate preventing it from updating properly. I have prepared a video that shows how to replicate it, you can use the same GitHub repository to replicate it.
Video:
https://www.youtube.com/watch?v=4H-faLUTNeM
GitHub sample:
I have found more errors in the SFListview for macOS, when the page is displayed for the first time the nested SFListview does not show its elements, however as I show in the video if I change the size of the application window the elements appear. On the other hand, there is a problem when scrolling with many elements in the list since the scroll of the SFListview conflicts with the scroll of the parent, when in theory the nested SFListview has IsScrollingEnabled in false so it should not happen, which causes If you scroll too far down from the beginning of the list, it will be impossible for you to return since even the scroll bar disappears. I leave a video with these two errors and the GitHub repository I have updated it with the macOS example.
Video:
https://www.youtube.com/watch?v=jZ6iOnh_v-Y
GitHub sample:
|
Query |
Response |
|
I also found another bug related to updating the element height of the SfListView runtime DataTemplate preventing it from updating properly. |
We could reproduce the reported scenario at our side. We are currently checking the same scenario further and update you the details on July 23, 2021. We appreciate your patience until then. |
|
I have found more errors in the SFListview for macOS, when the page is displayed for the first time the nested SFListview does not show its elements, |
We could not reproduce the reported scenario at our side, when using IsScrollingEnabled as False for the inner ListView. Please set the IsScrollingEnabled as False to overcome the reported scenario. |
|
On the other hand, there is a problem when scrolling with many elements in the list since the scroll of the SFListview conflicts with the scroll of the parent, when in theory the nested SFListview has IsScrollingEnabled in false so it should not happen, which causes If you scroll too far down from the beginning of the list, it will be impossible for you to return since even the scroll bar disappears. |
We could reproduce the reported scenario at our side. We need some more time to check on the scenario in our source level. We will check and update you further details on July 23, 2021. We appreciate your patience until then. |
|
Query |
Response |
|
I also found another bug related to updating the element height of the SfListView runtime DataTemplate preventing it from updating properly. |
We have checked the reported scenario on our side. We would like to inform you that this issue is related to the below issue,
We will ensure this case while fixing and the fix will be available as promised. We appreciate your patience until then.
|
|
On the other hand, there is a problem when scrolling with many elements in the list since the scroll of the SFListview conflicts with the scroll of the parent, when in theory the nested SFListview has IsScrollingEnabled in false so it should not happen, which causes If you scroll too far down from the beginning of the list, it will be impossible for you to return since even the scroll bar disappears. |
Sorry for the delay caused. We could reproduce the reported in simple nested ListView sample itself. We are currently checking the scenario with our development team. We will update you further details on July 27, 2021 and appreciate your patience until then. |