Performance issues and usability improvements

tualatintualatin Member ✭✭
edited February 6 in Xamarin University


I need some suggestions, help to solve any problems. I have to create a view with a dynamic count of ContentPages. I created two ViewModels, one with a logic and a stop watch and a second one to control the dynamic pages. It looks like this:


public class CircleViewModel: ViewModelBase {
    public ObservableCollection<Circle> Circles { get; set; }

    private string _timeText;

    public string TimeText { 
        get => _timeText; 
        set {
        _timeText = value; 

    // Some ICommands and methods

    public async Task StartStopWatch() { ... }


public class MultiPageViewModel : ViewModelBase {
public ObservableCollection<CircleViewModel> Pages { get; set; }

private CircleViewModel _currentPage;

public CircleViewModel CurrentPage { 
    get => _currentPage; 
    set {
         _currentPage = value;

 // Some ICommands and methods


<ContentPage ...
   BindingContext="{Binding MultiPageViewModel, Source={StaticResource Locator}}">
        <ListView ItemsSource="{Binding CurrentPage.Circles}"/>
        <Label Text="{Binding CurrentPage.Title}"/>
        <Button Text="{Binding CurrentPage.TimeText}" Command="{Binding CurrentPage.StartWatchCommand}"/>

        <userControls:VerticalTabView ItemsSource="{Binding MultiPageViewModel.Pages, Source={StaticResoruce Locator}}"
        MoreButtonCommand="{Binding MultiPageViewModel.MoreButtonCommand, Source={StaticResource Locator}}"/>

VerticalTabView is a user control to change the current page. I do not like the usability, so I changed the ContentPage to CarouselPage. With UWP it works fine, with Android the scrolling starts to stutter, in the output of Visual Studio appears "The application may be doing too much work on its main thread." and crashes with an OutOfMemory Exception. The CarouselPage does not work with iOS currently.

How can I improve this? I am grateful for any advice. Thank you.

Sign In or Register to comment.