private void InversionCombo_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.SelectedInversion = (InversionEnum)((ComboBox)sender).SelectedIndex; if (this.chordsCombo.SelectedItem != null) { this.ShowChord(this.chordsCombo.SelectedItem as Chord); } }
private void MainPage_Loaded(object sender, RoutedEventArgs e) { this.DataContext = ((App)Application.Current)?.ChordKeyboardViewModel; this.ChordKeyboardViewModel.PropertyChanged += this.ChordKeyboardViewModelPropertyChanged; this.ChordKeyboardViewModel.Settings.PropertyChanged += this.SettingsPropertyChanged; this.chordsCombo = this.FindName("ChordsComboBox") as ComboBox; this.selectedChordLabel = this.FindName("SelectedChordLabel") as Run; this.selectedChordInversionNotesLabel = this.FindName("SelectedChordInversionNotesLabel") as Run; this.inversionCombo = this.FindName("InversionCombo") as ComboBox; if (this.inversionCombo != null) { this.inversionCombo.SelectionChanged += this.InversionCombo_SelectionChanged; } if (this.chordsCombo != null) { this.chordsCombo.SelectionChanged += this.ChordsCombo_SelectionChanged; } this.chordKeyboardGrid = (Grid)this.FindName("ChordKeyboardGrid"); if (this.chordKeyboardGrid != null) { this.SizeChanged += this.MainPage_SizeChanged; } this.PopulateKeys(); if (this.chordsCombo.Items.Count > 0) { this.chordsCombo.SelectedIndex = 0; } if (this.inversionCombo.Items.Count > 0) { this.inversionCombo.SelectedIndex = 0; } this.SelectedInversion = 0; this.AdjustKeyboardAspectRatios(); }