private void LoadData() { Task.Factory.StartNew(() => { CommentsList.Clear(); List <Comment> comments = _dr.GetCommentsByPostId(post.Id); foreach (Comment c in comments) { CommentsList.Add(c); } }).ContinueWith(task => { activityIndicator.IsRunning = false; activityIndicator.IsVisible = false; }, TaskScheduler.FromCurrentSynchronizationContext()); }