private void SelectUser_SelectionChanged(object sender, SelectionChangedEventArgs e) { UserModel user = (UserModel)SelectUser.SelectedItem; ViewUserTask._tasks = TaskDB.GetTasks(user.Username); count = 0; _initialTasks.Clear(); if (ViewUserTask._tasks.Count != 0) { ViewUserTask.AddItems(); TasksList.ItemsSource = _initialTasks; TasksList.SelectedIndex = 0; NoTasks.Visibility = Visibility.Collapsed; } else { NoTasks.Visibility = Visibility.Visible; TasksList.Visibility = Visibility.Collapsed; DetailAndDiscussion.Visibility = Visibility.Collapsed; } }