public void UpdateStatisticItemsList() { var items = databaseController.GetItemsListForActivity().ToList(); items.Sort((pair1, pair2) => pair1.Value.CompareTo(pair2.Value)); StatisticItemsList.Items.Clear(); foreach (var item in items) { StatisticItemsList.Items.Add(new Label { FontSize = 16, Content = item.Value, Tag = item.Key, Foreground = Brushes.White }); } }