private void TuneControls() { var selected = SelectedCards.Select(c => c.Id).ToArray(); var cardControls = _data.Cards.OrderBy(c => c.Name).Select(c => new CardControl { Card = c }); _lb.ItemsSource = cardControls; if (selected.Any()) { var selectedCard = _data.Cards.FirstOrDefault(c => selected.Any(s => s == c.Id)); _lb.SelectedItem = cardControls.FirstOrDefault(cc => cc.Card == selectedCard); } _btnEdit.IsEnabled = SelectedCard != null; _btnRemove.IsEnabled = SelectedCards.Any(); }